generating waveforms

Started by nobox2003 May 14, 2007
hi guys I'm very new to Matlab and DSP and am in a bit a nitch.I need
to generate waveforms of 512 samples centred on sample 200 andI also
need to normalise the amplitude of each waveform to give it unity area
The wave forms are:
1. rectangular and triangulr pulses with 45 samples wide
2. Gaussian with st of 13.5
and a hamming window at Nf

really struggling with this one problem in particular but on the whole
the whole matlab thing is quite easy and quite understandable.
Would reall appreciate your help on this as soon as possible
Thanx
noxolo
Hi Noxolo,

I don't exactly understand what you are trying to do, can you clarify what you mean by "generating 512 samples centered on sample 200"? The following code is for what I think you are trying to do:

%vector x for square waveform

x = zeros(1,512);
x(178:222) = ones(1,45);

%vector y for triangle waveform

y = zeros(1,512);
y(178:222) = conv(ones(1,22),ones(1,22))/2;
I also don't understand what you mean by "Gaussian with st of 13". If you are looking for a sample function of a random variable with Gaussian distribution, the function "randn" will do that. If you need white Gaussian noise, the Communications Toolbox comes with the function "awgn". Also for the hamming window, if you have the DSP toolbox there is a function that I think is called "hamming" that will let you design the window. "fdatool" also has it, I believe

Good luck,
Wil
http://wilperkins.com

hi guys I'm very new to Matlab and DSP and am in a bit a nitch.I need
>to generate waveforms of 512 samples centred on sample 200 andI also
>need to normalise the amplitude of each waveform to give it unity area
>The wave forms are:
>1. rectangular and triangulr pulses with 45 samples wide
>2. Gaussian with st of 13.5
>and a hamming window at Nf
>
>really struggling with this one problem in particular but on the whole
>the whole matlab thing is quite easy and quite understandable.
>Would reall appreciate your help on this as soon as possible
>Thanx
>noxolo
>