How to turn off function values when using fsolve. ('Display','off') is not doing anything that is need it to do.

2 views (last 30 days)
My code is
options = optimoptions('fsolve','Display','off')
x0=[0.9;0.5;0.5];
xss=fsolve(@growthrate,x0,options)
%xss is the non-trivial steady state
x1=[1;11;1];
w=fsolve(@growthrate,x1,options)
W=round(w)
%w is the washout steady state
The output for the code is
growthrate_call
f =
0.0310
0.7811
0.3661
f =
0.0310
0.7811
0.3661
f =
0.0310
0.7811
0.3661
f =
0.0310
0.7811
0.3661
f =
0.1161
0.4902
0.5674
f =
0.1161
0.4902
0.5674
f =
0.1161
0.4902
0.5674
f =
0.1161
0.4902
0.5674
f =
0.0632
0.5815
0.3066
f =
0.0632
0.5815
0.3066
f =
0.0632
0.5815
0.3066
f =
0.0632
0.5815
0.3066
f =
0.1069
0.3454
0.3819
f =
0.1069
0.3454
0.3819
f =
0.1069
0.3454
0.3819
f =
0.1069
0.3454
0.3819
f =
-0.0323
0.3999
-0.0241
f =
-0.0323
0.3999
-0.0241
f =
-0.0323
0.3999
-0.0241
f =
-0.0323
0.3999
-0.0241
f =
-0.0053
0.0117
-0.0110
f =
-0.0053
0.0117
-0.0110
f =
-0.0053
0.0117
-0.0110
f =
-0.0053
0.0117
-0.0110
f =
1.0e-04 *
-0.2210
0.4911
-0.4641
f =
1.0e-04 *
-0.2210
0.4909
-0.4638
f =
1.0e-04 *
-0.2209
0.4908
-0.4639
f =1.0e-04 *
-0.2210
0.4911
-0.4644
f =1.0e-09 *
-0.3951
0.8776
-0.8294
f =1.0e-07 *
-0.0040
-0.1466
0.2644
f =1.0e-07 *
0.0863
-0.2068
0.1813
f =1.0e-07 *
-0.0388
0.0863
-0.3543
xss =
4.6931
0.5710
18.3029
f =
0.2560
-0.7912
0.8277
f =
0.2560
-0.7912
0.8277
f =
0.2560
-0.7912
0.8277
f =
0.2560
-0.7912
0.8277
f =
0.0100
-0.0303
-0.0361
f =
0.0100
-0.0303
-0.0361
f =
0.0100
-0.0303
-0.0361
f =
0.0100
-0.0303
-0.0361
f =
1.0e-03 *
-0.1876
0.4169
-0.3940
f =
1.0e-03 *
-0.1876
0.4170
-0.3940
f =
1.0e-03 *
-0.1876
0.4169
-0.3940
f =
1.0e-03 *
-0.1876
0.4169
-0.3940
f =
1.0e-07 *
-0.0532
0.1181
-0.1116
f =
1.0e-07 *
-0.0923
0.2382
-0.2519
f =
1.0e-07 *
-0.0532
-0.0458
-0.1116
f =
1.0e-07 *
-0.0532
0.1181
-0.0967
w =
-0.0000
11.0000
-0.0000
W =
0
11
0
How can i get the code to only display the values for xss, w, and W respectively. I do not want the "f=" values for each iteration to show up in my code. I tried playing around with the options and omtiset commands.

Answers (1)

Alan Weiss
Alan Weiss on 17 Apr 2016
As Walter suspects, I believe that in your growthrate code you left off a final semicolon from the line of code that creates f. I mean, in that code, you have a line like
f = a + b - c
when you should have
f = a + b - c;
(I am just making up a line of code that calculates f; the point is, it should have a semicolon at the end.)
Alan Weiss
MATLAB mathematical toolbox documentation

Categories

Find more on Function Creation 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!