Feb 8, 2006 #1 B 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
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
Feb 11, 2006 #2 R RDX* Newbie level 1 Joined Aug 26, 2004 Messages 1 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 10 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])
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])