フィルターのクリア

Please how do I get rid of local variables may have been changed to match the globals error?

4 ビュー (過去 30 日間)
I this error: Warning: The value of local variables may have been changed to match the globals. Future versions of MATLAB will require that you declare a variable to be global before you use that variable.
Also, I tried to loop over a solver because my function has a varying parameter xi. Please how I do plot a graph for the different parameters on the same figure? For instance, I wanna plot xi = -0.06 and xi=0.001 on the same figure. I have attched my code.

採用された回答

Torsten
Torsten 2022 年 9 月 15 日
Can you take it from here for your case ?
f = @(x,a) x.^2 + a.^2;
x = -2:0.01:2;
a = 0:0.1:1;
array = zeros(numel(a),numel(x));
hold on
for i = 1:numel(a)
array(i,:) = f(x,a(i));
plot(x,array(i,:))
end
hold off
  5 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 15 日
You do not fix it. You are treating v as if it is a function rather than an array.
Certainly you cannot fix it when there are no comments indicating what you hope to have happen there.
Note also that your right hand side does not involve i so you are calculating the same thing each iteration until you get to the point where v(i,:) and v(z,:) overlap (and which point you change what v(z,:) refers to and so you start storing different values than the iterations where i < min(z) )
University Glasgow
University Glasgow 2022 年 9 月 15 日
Thank you so much. I have been able do that now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by