hello guys Iva had a simple but confusing question… i was writing a program for Euler's formula, then I found out Matlab doesn't have any "goto" function for refering to previous lines . i was looking for an alternate and i will appreciate it if you guys help me with this 🙂 here's an example:
x=[0.1:0.1:1] h=0.1 i=1 y(1)=1 Z(1)=1.1 Y(1)=1.1 %Y'=y*(x^(1/3))
while i<11 y(i+1)=y(i)+(h*(x(i)*(y(i)^(1/3)))) Z(i+1)=(x(i+1)*(y(i+1)^(1/3)))line** y(i+1)=y(i)+(0.5*h*(Y(i)+Z(i+1))) Y(i+1)=x(i+1)+y(i+1) if abs(Y(i+1)-Z(i+1))>0.00000000001 Z(i+1)=Y(i+1) goto(line**) endi=i+1end
Best Answer