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.

plotting frequncy plot reading values from excel file

Status
Not open for further replies.

suru

Full Member level 3
Joined
Aug 31, 2007
Messages
157
Helped
4
Reputation
14
Reaction score
1
Trophy points
1,298
Activity points
1,934
sub:plotting frequncy plot reading values from excel file

i want to plot time and frequency plots reading from excel file.

the following lines are helpful for reading from excel file and selecting perticular column also.


time = xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);
%num;
inp = xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);

%inp;
outp= xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);
%outp;


i have got correct time plot but not getting correct frequncy plot. i got frequncy plot also but shows wrong values. program is written below.
plz help me.

complete program:

%reading excel column and plotting time and frequncy domain
%analysis- feb 2008.
clc
time = xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);
%num;
inp = xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);

%inp;
outp= xlsread('D:\INSTALLED\MATLAB\work\tone.xls',-1);
%outp;

subplot(2,2,1);
plot(time,inp);
grid on;
title(' input plot ');
xlabel('time----->');
ylabel('amp in volts----->');
%........................................
subplot(2,2,2);
plot(time,outp);grid on;
title(' output plot ');
xlabel('time----->');
ylabel('amp in volts----->');
subplot(2,2,3);
plot(inp( 200:6000),outp(200:6000));grid on;
title(' input vs output plot ');
xlabel('input----->');
ylabel('output----->');
%................fft sec...........
%...............................


Fs=-10000;

n=(1:100);
f1=outp/Fs; % digital freqency is the sampled frequency
x1=f1;%cos(2*pi*f1*n);

% number of samples for the FFT
N=512;

% we calculate just the magnitude (abs), not the phase
k=abs(fft(x1,N));

% now shift the spectrum to be centered
l=fftshift(k);
% X2=fftshift(X2);
% X3=fftshift(X3);

% digital frequency range will be from -1/2 to 1/2, so
% there is a need to unnormalize it to our sampling
% frequency, which is Fs.
% this means our freq range will go from -Fs/2 to Fs/2
f=Fs.*[-N/1:N/1-1]/N;


grid on;
title(' Frequency domain analysis ');
xlabel('frequency (Hz)----->');
ylabel('gain in db----->');
% .............end..............................
 

Hi,

I have Some questions.
Now, Were is the command for plotting "l"?
Why is the sampling frequency negative?
Would you please upload the excel file too.

Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top