Create an array for ? from 0 to 2? with 1000 elements and generate a graph showing sin(n?) for n=1, 2, … 5,

10 ビュー (過去 30 日間)
This is the Question but when I multiply n with theta it gives any error >> y = sin(n*theta); Error using * Inner matrix dimensions must agree. anyone can help with this.

採用された回答

KSSV
KSSV 2016 年 11 月 16 日
th = linspace(0,2*pi,1000) ;
n = 1:5 ;
y = zeros(length(n),1000) ;
for i = 1:length(n)
y(i,:) = sin(n(i)*th) ;
end
  3 件のコメント
KSSV
KSSV 2016 年 11 月 16 日
@ Guillaume yes you are right, but for the beginners to learn coding loop is one of the basic. On using straight away inbuilt functions I feel they cannot learn much of coding.
Hamid Bakht
Hamid Bakht 2016 年 11 月 29 日
how to add legends with graphs in this case

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by