The error that i get is:
??? Attempt to execute SCRIPT plot as a function.
Error in ==> plot at 24
plot(f,absyy(1:1001))
The m-file that makes this error is as follows, keep in mind that track03 is a text file with no header. This file starts at line 8.
Quote:
load track03.txt %Load the data. This must be a file with the header removed. track03(:,2)=[]; %Delete the second column
fftsize=65536; %FFT function size
figure %Open a new figure
%The factor of (2^15) is used to normalize the time series amplitude data to 1
Y = fft(track03/(2^15),fftsize); %Apply FFT function
absyy = abs(Y)/(2^15); %Get the magnitude of the complex vector returned by the fft() function
f = 44100*(0:1000)/fftsize; %Create the frequency array that corresponds to the fft() vector. 44100 is the sample rate plot(f,absyy(1:1001)) %1:1001 is the array range of points to plot title('Frequency content of y') xlabel('Frequency (Hz)')
%timelength is the size of the amplitude vector you are creating time for. %This is used to create a time vector to plot an amplitude vector against
timelength = size(track03); %Obtain the size of the input file for plotting purposes
time=0:1/44100:(timelength-1)/44100;
figure %open a new figure plot(time,track03(:,1)) %Plot amplitude vs. time title('Track 03 Time Series') xlabel('Time (s)') ylabel('Bits')
figure %open a new figure plot(time,track03(:,1)/(2^15)) %Plot amplitude vs. time title('Track 03 Time Series Normalized') xlabel('Time (s)') ylabel('Normalized Amplitude')
It looks like you've named your .m file "plot.m"
(or have another file named "plot.m"), so matlab
is trying to run your file rather than the normal
plot function you'd like to run to plot the data.
Try renaming your file or ensuring that you don't
have another file named plot.m in the directory.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum