fsolve with collocation (outside of the function)
2 views (last 30 days)
Show older comments
Consider the following problem. The problems solves the linear(and nonlinear) equation correctly
syms Y11 Y12
r=fsolve(@noneqih,[0 0 ]);
function F=noneqih(co)
Y11=co(1);Y12=co(2);
F=[Y11+Y12-3; Y11-Y12-1]
end
but if you want the values of F set outside of the function noneqih, you can not import them inside e.g the following problem dosnt work
syms Y11 Y12
Agg=[Y11+Y12-3; Y11-Y12-1];
r=fsolve(@noneqih,[0 0 ]);
function F=noneqih(co)
global Agg;
Y11=co(1);Y12=co(2);
F=Agg
end
2 Comments
Stephen23
on 29 Jun 2019
Edited: Stephen23
on 29 Jun 2019
I doubt that symbolic and/or global variables are helping you... in the first example they don't seem to be doing anything anyway.
Why not just parameterize a normal MATLAB function?:
For example, simply create a function handle for Agg and pass that.
Answers (0)
See Also
Categories
Find more on Numbers and Precision 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!