Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How can i write the frequency vector for frequency range 5-400 hz using 50 frequncy points

Asked by Lisa Justin on 13 Jul 2012

How can i write the frequency vector for frequency range 5-400 hz using 50 frequncy points

0 Comments

Lisa Justin

Products

No products are associated with this question.

2 Answers

Answer by Wayne King on 13 Jul 2012
Accepted answer

Hi Lisa, you cannot have 50 frequencies in 30 elements. Obviously whatever Q is here (is it a power spectral density estimate?) is an estimate at only 30 frequency points.

You can space your frequency vector to cover 5 to 400 Hz with fifty points and then select a subset of those 50 so that you can plot(f,Q)

freq = linspace(5,400,50);
% just making up some junk data to plot
Q = abs(randn(30,1));
plot(freq(1:30),Q)

0 Comments

Wayne King
Answer by Ryan on 13 Jul 2012
Edited by Ryan on 13 Jul 2012

FrequencyVector = linspace(5,400,50); %linspace(min,max,# of points)

2 Comments

Lisa Justin on 13 Jul 2012
 f=linspace(5,400,50);
plot(f,Q)
it won't work
Q has a length of 30x1
and f has a length of 1x50
How can i make f 1x30 and still ranging from 5-400 and 50 frequency points
Ryan on 13 Jul 2012

See Wayne King's answer. These type of details should be included in the original question to provide the best answer possible.

Ryan

Contact us