how to create a fuction p(t)

2 Ansichten (letzte 30 Tage)
clowen
clowen am 19 Feb. 2016
Kommentiert: Star Strider am 21 Feb. 2016
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

Akzeptierte Antwort

Star Strider
Star Strider am 19 Feb. 2016
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 Kommentare
clowen
clowen am 21 Feb. 2016
thank u sir :)
Star Strider
Star Strider am 21 Feb. 2016
My pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by