How can I retrieve variables from a nested function and use them on the parent function?
Show older comments
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!
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!