Generating Signal in MATLAB

Status
Not open for further replies.

jagthedag

Newbie level 1
Joined
Apr 5, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,288
geneate siganl given below :

a)s=3*sin(2*Pi*(0.13)*n)+2*cos(2*Pi*(0.3)*n)

b)s=7*sin(2*Pi*(0.1)*n)

for n=0,1,2,......,128.

and 1)plot magnitude and phase response
2)plot the frequency content of signal..

CAN ANYONE HELP ME WITH THIS PROBLEM?
 

hi
first you need to define n , as a matrix
n= 1 : 1 :128 ;
and then write down the equations
and then if you want to plot the two signals in the same graph you use:

graph
subplot(3,1,1); plot(x1)
title('...............');
subplot(3,1,2); plot(x2)
title('.......................');

that for example how to use multiplpot figure
i hoe that waht you want.
 



If you used subplot (3,1,1) this will divide the figure window into three parts, so , you have to use subplot (2,1,1) or equivalently (211) as show in the following code:


clc;
clear all;
close all;
n= 1 : 1 :128 ;
x1=3*sin(2*pi*(0.13)*n)+2*cos(2*pi*(0.3)*n);
x2=7*sin(2*pi*(0.1)*n);
subplot(2,1,1); plot(x1)
subplot(2,1,2); plot(x2,'r')





regards
 

simply use

gensig() command in matlab
see matlab help
 

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