Plotting functions in matlab

I am having trouble figuring out how to plot functions in matlab. Below are examples of functions I am having trouble with. I don't know what functions to use or even how to write it to where it could be plotted.
f(t) = Kt[u(t+a/2)-u(t-a/2)]
f(t) = Acos(pi*t/2)[u(t+2)-u(t-2)]
f(t) = Ae^(-2(t-1))u(t-1)
I am new to matlab, so anything would be helpful. Thanks.

 採用された回答

Youssef  Khmou
Youssef Khmou 2013 年 4 月 11 日

0 投票

hi, try as example :
% Constants
K=2.33;
A=1.45;
t=0:0.1:10;
a=0.45;
% Anonymous function
u=@(t) cos(t)
f1=K*t.*(u(t+a/2)-u(t-a/2));
f2=A*cos(pi*t/2).*(u(t+2)-u(t-2));
f3=A*exp(-2*(t-1)).*u(t-1);
figure, plot(t,f1,t,f2,'r',t,f3,'g'), legend('f1','f2','f3');
grid on,

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Objects についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by