Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

representing the signal in matlab??

Status
Not open for further replies.

buts101

Full Member level 3
Joined
Apr 29, 2005
Messages
168
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Activity points
2,867
hello there!!!
i want to define the signal which is represented by figure...like rectangular...sawtooth...etc...in matlab. plz give me the coding to do so...

eg. x(t)==t for t<1 and t>0
==1 for t>1
==0 otherwise..

thank you
 

Heres two ways of making a sawtooth-signal.

Code:
t=0:0.1:10;
x=zeros(1,length(t));
for index=1:length(t)
    if t(index)<1
    x(index)=t(index);
    end
end
plot(x)
and a vector based
Code:
t=0:0.1:10;
n=1/(t(2)-t(1));
x=[ones(1,n) zeros(1,length(t)-n)];
x=x.*t;
plot(x)

if you have Signal Processing Toolbox there is a sawtooth function.

eg.
fs = 10000;
t = 0:1/fs:1.5;
x = sawtooth(2*pi*50*t);
plot(t,x), axis([0 0.2 -1 1])
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top