please I need some help with this sinusoidal signal

Status
Not open for further replies.

tom12

Newbie level 2
Joined
Oct 5, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
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
 

%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
 

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.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…