Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Thu 07-03-2025 4:43AM

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: matlab help
PostPosted: Mon 09-18-2006 10:01PM 
Offline
Captain

Joined: Wed 06-30-2004 9:01AM
Posts: 143

Source: Fidelity
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')
[/quote]


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 09-19-2006 5:20AM 
Offline
Sergeant

Joined: Sun 03-09-2003 9:34PM
Posts: 47

Source: Fidelity
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.

Bill


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 09-19-2006 9:59AM 
Offline
Captain

Joined: Wed 06-30-2004 9:01AM
Posts: 143

Source: Fidelity
you would be correct. thanks for all your help.


Top
 Profile E-mail  
    
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group