how to create a fuction p(t)

2 ビュー (過去 30 日間)
clowen
clowen 2016 年 2 月 19 日
コメント済み: Star Strider 2016 年 2 月 21 日
i have to plot s(t) where s(t)=p(t)cos(wt)-p(t-2*pi)cos(wt)+cos(t-(3*pi/2))sin(wt)-p(t-(5*pi/2))sin(wt) where p(t)=cos(t) for -pi/2 to pi/2 =0 for else where w=2*pi*100*10^3

採用された回答

Star Strider
Star Strider 2016 年 2 月 19 日
This runs. I will let you determine if it produces the result you want:
w=2*pi*1.0E+5;
p = @(t) cos(t) .* ((-pi/2 <= t) & (t <= pi/2));
s = @(t) p(t).*cos(w*t)-p(t-2*pi).*cos(w*t)+cos(t-(3*pi/2)).*sin(w*2*t)-p(t-(5*pi/2)).*sin(w*t);
t = linspace(-pi, 2*pi);
figure(1)
plot(t, s(t))
grid
  2 件のコメント
clowen
clowen 2016 年 2 月 21 日
thank u sir :)
Star Strider
Star Strider 2016 年 2 月 21 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by