electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

plotting frequncy plot reading values from excel file


Post new topic  Reply to topic    EDAboard.com Forum Index -> Software Problems, Hints and Reviews -> plotting frequncy plot reading values from excel file
Author Message
suru



Joined: 31 Aug 2007
Posts: 164
Helped: 4


Post22 Feb 2008 9:14   

plotting frequncy plot reading values from excel file


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..............................
Back to top
Google
AdSense
Google Adsense




Post22 Feb 2008 9:14   

Ads




Back to top
dspman



Joined: 14 Mar 2004
Posts: 56
Helped: 5


Post24 Feb 2008 14:34   

plotting frequncy plot reading values from excel file


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
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Software Problems, Hints and Reviews -> plotting frequncy plot reading values from excel file
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Reading values from file in SystemC (2)
MPLAB .M program to plot 3D curve, reading a .TXT file (9)
How to read from excel file using c++ (4)
Reading file from floppy (3)
Reading data from a file in Proteus VSM? (2)
Test Bench reading from an extern File on VHDL (4)
need help to plot ECG wave at MATLAB from some .txt file (6)
AWR- error in plotting Antenna Plot (1)
reading smd values (13)
reading transistor values (4)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS