plot variable values of loop

1 回表示 (過去 30 日間)
Ani Asoyan
Ani Asoyan 2020 年 4 月 2 日
編集済み: Ani Asoyan 2020 年 4 月 3 日
Hello
I have a code like this
for k=1:3
%something
if %one condition
d=d-2
if %the other condition
d=d+3
end
end
end
Basically I've written a loop in which I change the value of d
I have 3 iterations and 3 values of d.
I want to plot the values of d against the iteration's number, so that the x axis will be the iteration numbers and the y axis will be the values of d. How can I do this?
I've searched similar questions but haven't found like this one.
Thank you
  6 件のコメント
Rik
Rik 2020 年 4 月 3 日
If you indeed call your function with this
p=u_p(Z(:,1), Z(:,3), Z(:,2),d(k)).';
then your function should look like this
function u=u_p(x,x_e,N,d)
u = -(x-x_e).^2+N.*d;
end
Ani Asoyan
Ani Asoyan 2020 年 4 月 3 日
編集済み: Ani Asoyan 2020 年 4 月 3 日
I got it ! Thank you sooo much!!

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by