loop in function issue. I have pretty basic knowledge in MATLAB , I am struck as in the result function as there are some terms which are function of i( i can be interpreted as each division length) and k(temperature) .please correct my format

1 view (last 30 days)
% Tv is the temperature
% i can be interpreted as each division lenght
Tv(k)=k+273;
for i=1:lLt
result(i)=@(z,rc) (((((-2*meuv(k)*(fre0*(1+((4*N*(W^3))/(3*pi*((4*(pi*(rv^2)+N*((rc^2*(asin(w1/2*rc)))-(rv^2))+((w1*rv*cos(phi))/2)-(w1*rc*cos((asin(w1/2*rc)))/2)))/((2*pi*rv)-(2*N*rv*phi)+(2*N*rv*(asin(w1/2*rc))))^3)))*frev*(newv(k)/newl(k))*A2))*ml(i))/((4*(N*((hg*(w1+w2)/2)+(w1*rc(i)*cos(asin(w1/(2*rc)))/2)-((rc^2)*(asin(w1/2*rc)))))/N)/(w2+(2*((((w2-w1)/2)^2+(hg)^2))))^2* (pi*(rv^2)+N*((rc^2*(asin(w1/2*rc)))-(rv^2))+((w1*rv*cos(phi))/2)-(w1*rc*cos((asin(w1/2*rc)))/2))*rowl(k))*N))-(((-2*meuv(k)*frev*mv(i))/((4*(pi*(rv^2)+N*((rc^2*(asin(w1/2*rc)))-(rv^2))+((w1*rv*cos(phi))/2)-(w1*rc*cos((asin(w1/2*rc)))/2)))/((2*pi*rv)-(2*N*rv*phi)+(2*N*rv*(asin(w1/2*rc))))^2*(pi*(rv^2)+N*((rc^2* (asin(w1/2*rc)))-(rv^2))+((w1*rv*cos(phi))/2)-(w1*rc*cos( (asin(w1/2*rc)))/2))*rowv(k)))))*(rc^2))/sigma(k);
tspan=[0 lLt];
rc0=0.02;
res = ode45(result,tspan,rc0);
end
end
  2 Comments
Mathieu NOE
Mathieu NOE on 24 Dec 2020
hi
you should provide a complete code, because many variables and constants are not initialized in your piece of code
Mathieu NOE
Mathieu NOE on 27 Dec 2020
hello
it's a pretty complicated code with not much comments , quite difficult to understand the goal of it
I assume this work has been done from a publication, if yes , that could be a good idea to share it and also tell where you have difficulties

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!