フィルターのクリア

how to use legends for polarplot

31 ビュー (過去 30 日間)
Hamid Bakht
Hamid Bakht 2016 年 12 月 1 日
編集済み: Jesus Sanchez 2018 年 7 月 16 日
>> theta = linspace(0,2*pi,1000); n = 1:5; y = zeros(length(n),1000); for i = 1:length(n) y(i,:) = sin(n(i)*theta); end polarplot(theta,y);
This is my program. I am using for loop to go through n = 1;5 and i wanna add Legends with each polarplot and i wanna use loop
Thank you for your time

回答 (1 件)

Jesus Sanchez
Jesus Sanchez 2018 年 7 月 16 日
編集済み: Jesus Sanchez 2018 年 7 月 16 日
As you are using polarplot instead of polarpatter, you can directly use "legend" to that, like a normal plot. Just define a legend that increments each loop and then it adds it to the polarplot. I would do something like this:
leg='';
figure
hold on
for n=1:5
polarplot(theta,y(n,:));
leg = strcat(leg,''',num2str(n),''');
end
legend(leg);
NOT TESTED, but it should be something like that

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by