Graph is Blank ? why?
显示 更早的评论
The graph for Magnitude vs Frequency is blank. Why is that? The graph of time vs ich isn't blank. y_fft is a 4001x1 column with each entry being Nan. I do not understand whyload AdaptiveFiltereData
d = AdaptiveFilteredData;
fs =100;
dt = .001;
t = 0:dt:4.0001;
%ich = AdaptiveFilteredData.ichannel;
%qch = AdaptiveFilteredData.qchannel;
%plot(ich,qch);
%%PLOTS
%plot(t,ich);
%plot(t,qch);
figure;
plot(t,ich)
xlabel('time(s)');
ylabel('Amplitude');
grid on
Nsamps = length(ich); % Window length
y_fft = abs(fft(ich)); %Retain Magnitude
%f = fs(1/(dt*n)*(0:n));
f = fs*(0:Nsamps/2-1)/Nsamps; %Prepare freq data for plot
figure;
plot(f, y_fft(1:length(f)));
%Magnitude vs Freplot(f, y_fft); % FFT plot
xlim([0 1]);
xlabel('Frequency(Hz)');
ylabel('FFT Magnitude');
grid on
1 个评论
hosein Javan
2020-8-13
can you share the image of plot(t,ich) or its data file?
回答(2 个)
Walter Roberson
2020-8-13
0 个投票
"The graph of time vs ich isn't blank"
At least one entry in ich is nan or infinite, and that is leading to the fft being all nan. fft can only process finite points.
Another possibility is that the individual points are all finite but that they are large enough that the fft calculations are overflowing. For example if the values exceed sqrt(realmax) then multiplication could create infinity
4 个评论
hosein Javan
2020-8-13
Walter Roberson is there a way to work with numbers exceeding realmax and realmin? not using symbolic.
what is fixed-point designer for? I couldn't find an example in matlab help. thank you.
Walter Roberson
2020-8-13
realmin is the smallest normalized floating point number. Values smaller than it do not lead to overflow for fft (but could lead to overflow if you divide something by them)
You can look in the File Exchange for John D'Errico Variable Precision toolboxes.
Fixed Point Designer is a tool to help analyze numeric ranges in order to determine optimal fixed point software settings. I believe it can also help convert source to use fixed point classes.
I do not know what the upper limits are on fixed point calculations.
Fixed point calculations that use trig or logarithms often call for using substitution code, as software emulation of the hardware algorithms is often just too expensive. Also, division is often replaced such as by calculating reciprocal and then multiplying.
hosein Javan
2020-8-13
编辑:hosein Javan
2020-8-13
Walter Roberson thank you for replying. I've seen it before. I wonder how someone has managed to do something with matlab with its limitation of realmax.if it says it is not symbolic. is it using strings to compute these large data? or is it below realmax but can show more digits? another thing. what about speed? is it as slow as symbolic toolbox? because however matlabbuiltin functions are written in C language.
Walter Roberson
2020-8-13
If you are talking about John's contributions then the answer is that he defined a class and operations on the class. The class uses blocks of numbers as decimal digits, and standard techniques for extended precision calculations.
Bruno Luong
2020-8-13
编辑:Bruno Luong
2020-8-13
Try to add this after the statement of loading the file
ich=fillmissing(ich,'nearest')
and see it it fixes the issue.
类别
在 帮助中心 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!