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 次查看(过去 30 天)
显示 更早的评论
% 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 个评论
Mathieu NOE
2020-12-24
hi
you should provide a complete code, because many variables and constants are not initialized in your piece of code
Mathieu NOE
2020-12-27
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
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!