how to create a fuction p(t)

4 visualizaciones (últimos 30 días)
clowen
clowen el 19 de Feb. de 2016
Comentada: Star Strider el 21 de Feb. de 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

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Animation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by