フィルターのクリア

using variables in a legend, title, or axis

2 ビュー (過去 30 日間)
Daniel
Daniel 2013 年 4 月 22 日
Is it possible to insert variables into a string like a legend or title? For example, I'm modeling a difference equation, and I'm using for-loops to test different parameters within the equation; is it possible to plot the results where the parameter value can be displayed in a legend or title with each for-loop iteration? Thanks!
x=zeros(1,100);
for p=1:3 %test different values for parameter lambda
lambda=p*20; %lambda changes arithmetically
for q=1:3 %test different values for parameter b
b=q;
for n=1:99
x(1)=1;
x(n+1)=lambda*x(n)/(1+x(n))^b;
end
figure
plot(1:100,x,'r')
end
end

採用された回答

Walter Roberson
Walter Roberson 2013 年 4 月 22 日
title( sprintf('lambda = %f', lambda) );
  1 件のコメント
Daniel
Daniel 2013 年 4 月 23 日
Great! Thanks

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by