이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
calculate normalised frequency of the below plot
조회 수: 1 (최근 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에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)