現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
calculate normalised frequency of the below plot
2 ビュー (過去 30 日間)
古いコメントを表示
How to calulate frequency from above graph?
convert normalised frequency(0.03) into frequncy(hz)?
how to do this?
採用された回答
Star Strider
2019 年 8 月 12 日
‘convert normalised frequency(0.03) into frequncy(hz)?’
Multiply the normalised frequency by the Nyquist frequency.
The sampling frequency is 1/(sampling interval). The Nyquist frequency is one-half of the sampling frequency.
20 件のコメント
Star Strider
2019 年 8 月 12 日
You can easily calculate the sampling interval if you have a time vector ‘t’ as:
Ts = t(2)-t(1); % Sampling Tiume (Assumes Uniform Sampling)
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
You must have either the time vector or the sampling frequency already. If you do not have at l;east one of those data, all hope is lost for calculating the Nyquist frequency.
Star Strider
2019 年 8 月 12 日
No. Not the way it is presented. If the plot used markers to plot the individual data points (rather than lines connecting them), it might be possible to estimate the sampling frequency and sampling interval.
If you have the .fig file for the first plot, it is relatively straightforward to recover the Line objects and get the 'XData' from them, and from that the sampling interval.
If you have the .fig file for the first plot, attach it to a Comment here. If all goes well, I can probably recover the 'XData' vector from it, and compute the information you want.
Venkatkumar M
2019 年 8 月 12 日
Star Strider
2019 年 8 月 12 日
The ‘fig.mat’ file has a bunch of structures in it, none of which seem to contain anything that could be plotted. What do you want me to get from this file? What particular structures should I look at?
The ‘op.txt’ file has three columns and no explanation of any of them. None of the columns appears to be a time vector. What is it?
Venkatkumar M
2019 年 8 月 12 日
op.txt is ouput that i get as output in a c code. i dont get time vectors out of it..
intead of normalised freq(Pi* rad/sam) i need it like frequency(Hz)
Star Strider
2019 年 8 月 12 日
If you do not have a time vector for ‘op.txt’, then it can be anything you want. Do you know what the time units should be (e.g. weeks, hours, nanoseconds)?
Star Strider
2019 年 8 月 12 日
Try this:
fnm2 = 'op.txt';
D2 = load(fnm2);
ts = 1:size(D2,1); % Time Units In Seconds
L = numel(ts); % Time Units In Seconds
Ts = ts(2)-ts(1); % Sampling Tiume (Assumes Uniform Sampling)
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTD2 = fft(D2)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
subplot(2,1,1)
plot(Fv, abs(FTD2(Iv,:))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: s')
subplot(2,1,2)
plot(Fv*1E+9, abs(FTD2(Iv,:))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: ns')
Using the ‘ts’ vector as the time vector, the Fourrier transform is straightforward to calculate and plot. To use nanoseconds as the time unit, it is only necessary to multiply ‘Fv’ by for the plot, since that is the only thing that changes.
All the data are plotted, however the data for the third vector obscures the first two. You may want to plot them separately:
figure
subplot(3,1,1)
plot(Fv*1E+9, abs(FTD2(Iv,1))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: ns')
subplot(3,1,2)
plot(Fv*1E+9, abs(FTD2(Iv,2))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: ns')
subplot(3,1,3)
plot(Fv*1E+9, abs(FTD2(Iv,3))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: ns')
Experiment to get the result you want.
Venkatkumar M
2019 年 8 月 13 日
i have simple question what is the difference between fft(your plot) and power spectrum(my plot)?
Star Strider
2019 年 8 月 13 日
As always, my pleasure.
They are essentially the same, however the fft displays the absolute value of the amplitude, and the power spectrum displays the squared absolute value of the amplitude. There may be slight differences depending on how the power spectral density is computed, since some compute it slightly differently (for example the pwelch function uses overlapping segment averaging).
Star Strider
2019 年 8 月 13 日
All you need to do is to square the fft output vector using element-wise operations, for example:
figure
subplot(2,1,1)
plot(Fv, (abs(FTD2(Iv,:))*2).^2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Time Units: s')
Do the same for the others.
Venkatkumar M
2019 年 8 月 13 日
Hi I have got Power density
but i want to sperate each plots.
as u did done it before how to do that?
code is below
rng default
fnm2 = 'op.txt ';
D2 = load(fnm2);
ts = 1:size(D2,1); % Time Units In Seconds
L = numel(ts); % Time Units In Seconds
Ts = ts(2)-ts(1); % Sampling Tiume (Assumes Uniform Sampling )
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
[pxx,f] = pwelch(D2,fs);
plot(f,10*log10(pxx))
xlabel('Frequency (Hz)')
ylabel('PSD (dB/Hz)')
Venkatkumar M
2019 年 8 月 13 日
since fs =1 it shows error and in case if i change it the fs=1000 figure plot displays
Star Strider
2019 年 8 月 13 日
You need to understand the argument list order for the pwelch function.
Try this:
[pxx,f] = pwelch(D2,[],[],[],Fs);
figure
subplot(3,1,1)
plot(f, pxx(:,1))
grid
xlabel('Frequency (Hz)')
ylabel('PSD')
title('Column 1')
subplot(3,1,2)
plot(f, pxx(:,2))
grid
xlabel('Frequency (Hz)')
ylabel('PSD')
title('Column 2')
subplot(3,1,3)
plot(f, pxx(:,3))
grid
xlabel('Frequency (Hz)')
ylabel('PSD')
title('Column 3')
That worked when I ran it.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Transforms and Spectral Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)