MATLAB Answers

How to label answers from a function you called in a script?

3 views (last 30 days)
Erik Ramirez
Erik Ramirez on 15 Oct 2019
Answered: darova on 15 Oct 2019
fromatmedium.jpg
When i call the ODESystemSolver i get two answers back. But how can i label them in the code. Basically need those two answers to input them into my secant method function to get a new approximations then repeat the step. i added a picture of what im trying to do i hope its understandable. Sorry for long question

  0 Comments

Sign in to comment.

Answers (1)

darova
darova on 15 Oct 2019
You just want to pass your functions to SecantMethod if i understood your correctly
Type this in the main script
syms x1(t) lambda1(t)
x1(t) = ODE.x; % get solution functions
lambda1(t) = ODE.lambda;
t = linspace(0,2); % time span
x0 = x1(t); % numeric solution
l0 = lambda1(t);
% pass values to SecantMethod
for i = 1:length(t)-1
lam1 = SecanthMethod([x0(i:i+1); l0(i:i+1)]);
if lam1 what?
break
end
end

  0 Comments

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!