Difficulty plotting equations.

1 回表示 (過去 30 日間)
Brendan Clark
Brendan Clark 2021 年 4 月 5 日
コメント済み: Brendan Clark 2021 年 4 月 5 日
I'm just starting to learn to plot equations in 2D format in matlab and I'm having some issues getting started.
Right now I'm attempting to get two equations to display on the same plot.
I mostly don't entirely understand why I'm receiving the error message that I am.
The code I'm using so far is.
t=0:.2:2;
y1(t)=1*cos((2*pi)*(3*t))+0.8*sin((2*pi)*(8*t));
y2(t)=0.6*cos((2*pi)*(0.6*t)+(pi/3))+0.25*sin((2*pi)*(10*t));
plot(t,y1)
plot(t,y2)
the error code I'm receiving is.
Array indices must be positive integers or logical values.
Error in Untitled4 (line 2)
y1(t)=1*cos((2*pi)*(3*t))+0.8*sin((2*pi)*(8*t));
This is homework, the ultimate goal is to create this plot, however, as mentioned, I'm really just having trouble even getting the equation to plot, I'm mostly just trying to get help past the minor roadblock, I'm sure I can figure out how to color code and all that afterwards. I appreciate any help, hints, tips, or recommendations, thanks!

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 4 月 5 日
編集済み: KALYAN ACHARJYA 2021 年 4 月 5 日
#Do modification, no coding error
t=0:.2:2;
y1=1*cos(2*pi*3*t)+0.8*sin(2*pi*8*t);
y2=0.6*cos(2*pi*0.6*t)+(pi/3)+0.25*sin(2*pi*10*t);
plot(t,y1,t,y2);
  1 件のコメント
Brendan Clark
Brendan Clark 2021 年 4 月 5 日
Thank you! I knew I was close.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by