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

제품

태그

질문:

2013년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by