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 CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by