# How to get a smooth plot by filtering the sudden variation of the data?

2 Ansichten (letzte 30 Tage)
Sateesh Kandukuri am 11 Mär. 2023
Kommentiert: Sateesh Kandukuri am 11 Mär. 2023
I calculated the numerical derivative of my data as a function of time to get the speed. I got a noisy curve. Then I took the Fourier transform of the velocity data and filtered it to remove the sudden variations and smoothen it. The filtered data is not matching with the unfiltered data. Can anybody help me to solve this issue?
clear;
t = A(:,1);
v = A(:,2);
vfreq=fft(v);
vfreq1=fftshift(vfreq);
vfreq2=vfreq1;
for k=1:485
vfreq2(k)=0;
end
for k=515:size(vfreq1,1)
vfreq2(k)=0;
end
vfreq2=ifftshift(vfreq2);
dvxfilt=ifft(vfreq2);
plot(t/1e-9,dvxfilt);
xlabel('t (ns)')
ylabel('v')
xlim([0 100]);
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Bruno Luong am 11 Mär. 2023
Bearbeitet: Bruno Luong am 11 Mär. 2023
It recovers a big tail part of the signal. Hard to guess what should be the signal at the begining.
x=A(:,1);
A=A(:,2);
B=flip(unwrap(flip(A)*10)/10);
plot(x,A,"g")
hold on
plot(x,B,'r','LineWidth',2) ##### 3 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
Sateesh Kandukuri am 11 Mär. 2023
@Bruno Luong These fluctuations are mainly due to my system behaviour. We verified the data. The position functions are varying smoothly. Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Surface and Mesh Plots in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!