# please I need some help with this sinusoidal signal

1. ## please I need some help with this sinusoidal signal

I try to generate a sinusoidal signal in matlab which is :

Amplitude = 10

Frequency = 100

sample rate = 5000

singal duration T = 1 sec

initial phase = 0

But does not come with me . Can any one help me with the code?

Thanks

•

2. ## Re: please I need some help with this sinusoidal signal

%program to generate sine wave

f= input('enter the frequency in hertz of the sine wave');
t=0:.0001:5;
y=sin(2*pi*f*t);
plot(t,y);
ylabel ('Amplitude');
xlabel ('Time Index');
TITLE ('Sine wave');

%with samples

t = [ 0 : 1 : 40 ]; % Time Samples
f = 500; % Input Signal Frequency
fs = 8000; % Sampling Frequency
x = sin(2*pi*f/fs*t); % Generate Sine Wave
figure(1);
stem(t,x,'r'); % View the samples
figure(2);
stem(t*1/fs*1000,x,'r'); % View the samples
hold on;
plot(t*1/fs*1000,x); % Plot Sine Wave

good luck

1 members found this post helpful.

•

3. ## Re: please I need some help with this sinusoidal signal

Originally Posted by pakitos
%program to generate sine wave

f= input('enter the frequency in hertz of the sine wave');
t=0:.0001:5;
y=sin(2*pi*f*t);
plot(t,y);
ylabel ('Amplitude');
xlabel ('Time Index');
TITLE ('Sine wave');

%with samples

t = [ 0 : 1 : 40 ]; % Time Samples
f = 500; % Input Signal Frequency
fs = 8000; % Sampling Frequency
x = sin(2*pi*f/fs*t); % Generate Sine Wave
figure(1);
stem(t,x,'r'); % View the samples
figure(2);
stem(t*1/fs*1000,x,'r'); % View the samples
hold on;
plot(t*1/fs*1000,x); % Plot Sine Wave

good luck
thanks a lot for help

but what about if I have like thses tow what I need to write in matlap so this function can work :

1- Create a function using mat lab to generate a sinusoidal signal.
The parameters of the signal should have an Amplitude = 100
frequency = 100Hz
initial phase = 0
sample rate = 5000
signal duration (T) = 1 sec.

2- Add another sinusoid with frequency 1000 Hz and amplitude 100 to the one generated in 1. (All other parameters are the same). plot two cycles of the sum of the two signals in time.

thanks a lot

•

4. ## Re: please I need some help with this sinusoidal signal

Please be specific regarding what is required, only then anyone can help you in generating the waveform. Also try out a few things yourself, we get to learn a lot when we try different things.

--[[ ]]--