(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Here's my code

clc

clear

n=10

a=input( 'initial guess for a ');

b=input( ' initial guess for b ');

C= input( ' initial guess for Steady State Concentration ');

d=[a

b

C]

while n>0

t=[3

9

12

18

24

300

]; %times recorded

Y=[4.1

4.3

3.9

3.4

3.1

2.7]; %Concentrations recorded

R=[(-Y+C+a.*exp(-.47.*t)+b.*exp(-0.6e-1.*t)).^2] %Residual vector

J1= [(2.*(-Y+C+a.*exp(-.47.*t)+b.*exp(-0.6e-1.*t))).*exp(-.47.*t)]; %partial with respect to a

J2= [(2.*(-Y+C+a.*exp(-.47.*t)+b.*exp(-0.6e-1.*t))).*exp(-0.6e-1.*t)]; %partial with respect to b

J3= [(-2.*Y)+(2.*C)+(2.*a.*exp(-.47.*t))+(2.*b.*exp(-0.6e-1.*t))]; %partial with respect to C

Jacobian= [J1 J2 J3]

JT= [J1 J2 J3]' %transpose Jacobian

JA=inv(JT*Jacobian) %inverse Jacobian*transpose Jacobian

deltax=[JA*JT*R]

if d-deltax <.0001

a=

if d-deltax >.0001

break

end

end

n=n-1

end

My question is how would I make my a, b and c values inside the "d" vector = to each value of my deltax vector within the loop such that they are replaced for every iteration?

I can't remember anything from matlab. it's been 2 years...

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab noob question.

**Physics Forums | Science Articles, Homework Help, Discussion**