Hi, How do you plot cos(omega*t) where omega=2*pi*f, for range of frequency like (20:2000). I am confused because there is both time and frequency, do we need to convert time to frequency domain?

 採用された回答

Jos (10584)
Jos (10584) 2016 年 6 月 20 日
編集済み: Jos (10584) 2016 年 6 月 20 日

1 投票

This might guide you a little:
t = linspace(0,10,1000) ; % time vector
f = 20 ; % a frequency
omega = 2.*pi.*f ; % calculate omega
y = cos(omega.*t) ; % calculate cosine for this time span
plot(t,y) % plot it
(btw, I prefer to use the .* notation for multiplication)

5 件のコメント

shashank
shashank 2016 年 6 月 20 日
is it possible to plot with frequency varying from 20:2000 hz for example with x axis as frequency? i am not certain that i need to do FFT
Steven Lord
Steven Lord 2016 年 6 月 20 日
If you're using plot you have two axes so you can plot {something} versus {something else}. For {something} you want to use frequency; is {something else} t or y? Or do you want to create a 3-D plot where the X axis corresponds to frequency, Y axis to time, and Z axis to the value of the variable y?
shashank
shashank 2016 年 6 月 20 日
so i have this function f=cos(w*t), i want to plot in 2D (in frequency domain) with x axis as frequency and magnitude in y axis do i need to do FFT? if x axis ranges from 20:2000
Jos (10584)
Jos (10584) 2016 年 6 月 20 日
the magnitude does not change with the frequency ... Or do you mean something else?
shashank
shashank 2016 年 6 月 20 日
編集済み: shashank 2016 年 6 月 20 日
This is exactly what i wanted to knw, so magnitude do not change with frequency for f=cos(w*t)?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2016 年 6 月 20 日

編集済み:

2016 年 6 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by