How can I retrieve variables from a nested function and use them on the parent function?
이전 댓글 표시
Hey guys, I have a little problem here with variables on nested functions. Here is the code:
function Parent
%code goes here
function dx = odestribeck (t,x)
dx=[x(2);-(Fc*tanh(x(2))+sig2*x(2)+(Fs-Fc)*exp(-(x(2)/Vstri)^2)+k*x(1))/m];
ode = @odestribeck;
alg;
function alg
[t,x]=ode15s(ode,[0,5],[0,5]);
end
end
%Command to plot variables t and x defined on function alg goes here.
end
As written on the code, I want to include a plot command on the parent function to the variables t and x defined on alg function (second level nested function).
Thank you in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!