Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Find fundamental period using stem function

Status
Not open for further replies.

scdoro

Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
Hi all,

i am new to Matlab.Could anyone help me to generate and plot the below 3 sequences using Matlab "stem" function What should i define in my script?

x1[n]=sin(0.6Пn+0.6П)
x2[n]=sin(0.68Пn)
x3[n]=3sin(1.3Пn)-4cos(0.3Пn+0.45П)

thanks alot

regards

scdoro
 

from matlab 7.0 "doc stem":

Two Series of Data on One Graph
The following example creates a stem plot from a two-column matrix. In this case, the stem function creates two stemseries objects, one of each column of data. Both objects' handles are returned in the output argument h. h(1) is the handle to the stemseries object plotting the expression exp(-.07*x).*cos(x). h(2) is the handle to the stemseries object plotting the expression exp(.05*x).*cos(x). x = 0:25;
y = [exp(-.07*x).*cos(x);exp(.05*x).*cos(x)]';
h = stem(x,y);
set(h(1),'MarkerFaceColor','blue')
set(h(2),'MarkerFaceColor','red','Marker','square')

For your issue:

x[n]= [sin(0.6Пn+0.6П); sin(0.68Пn); 3sin(1.3Пn)-4cos(0.3Пn+0.45П)];
stem(n,x)

Good luck!
 

hi Dova,

The following MATLAB function can be used to compute samples of the
DTFT of a
finite length signal.

Qn1) Can someone explain how this function works line by line?

**********************************************
Function [H,W] = dtft(x, n)
% Calculates DTFT of x at n equally spaced frequencies
% Usage:
% x: finite-length input vector (of length L)
% n: number of frequencies for evaluation over
% [-pi,pi]. n>=L.
% H: DTFT values
% W: vector of frequencies where DTFT is computed.
n=fix(n);
L=length(x); h=h:))
if (n < L)
error(‘DTFT: #data samples cannot exceed # freq samples.’)
end
W = (2*pi/n) * [0:(n-1)]’;
mid = ceil(n/2) + 1;
W(mid:n) = W(mid:n) – 2*pi;
W = fftshift(W);
H = fftshift( fft(h,n) );

**********************************************************

Qn2) plot the magnitude and phase responses of the signal xn, given
by

a = 0.88 * exp( j*2*pi/5 );
nn = 0:40;
xn = a.^nn;
for n = 128.

thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top