How to remove spurious lines?

4 Ansichten (letzte 30 Tage)
tandemuse
tandemuse am 15 Apr. 2021
Kommentiert: Star Strider am 17 Apr. 2021
Hello everyone! Why do these horizontal lines appear in the last plot and how can I remove them?
fs = 100;
data = load("data.txt");
distance = 0.4;
time = data(:,1);
amplitude = data(:,2);
fstep = 2 : 1 : -1+0.5*fs;
N = numel(fstep)-1;
central_freqs = NaN([1 N]);
filtered = NaN([numel(time) N]);
for i = 1:N
filtered(:,i) = bandpass(amplitude,[fstep(i) fstep(i+1)],fs);
filtered(:,i) = filtered(:,i)/max(abs(filtered(:,i)));
central_freqs(i) = 0.5*(fstep(i) + fstep(i+1));
end
[Freqs,Time] = meshgrid(central_freqs,time);
surf(Freqs,Time,filtered);
shading interp
view([0 90])
ylim([-1 0])
xlim([min(central_freqs) 15])
cb = colorbar;
ylabel(cb,'Amplitude')
xlabel("Frequency (Hz)")
ylabel("time (s)")
title("Initial image")
plot3(Freqs,Time,filtered)
velocity = distance./(Time - 0.25./Freqs);
surf(Freqs,velocity,filtered);
shading interp
ylim([-2 0])
xlim([min(central_freqs) 15])
view([0 90])
cb = colorbar;
ylabel(cb,'Amplitude')
xlabel("Frequency (Hz)")
ylabel("phase velocity (km/s)")
title("Transformed image")
plot3(Freqs,velocity,filtered)
ylim([-2 0])
xlim([2.5 15])

Akzeptierte Antwort

Star Strider
Star Strider am 15 Apr. 2021
Sort ‘velocity’:
[velocity, idx] = sort(velocity);
figure
plot3(Freqs,velocity,filtered(idx))
ylim([-2 0])
xlim([2.5 15])
grid on
producing:
.
  8 Kommentare
tandemuse
tandemuse am 17 Apr. 2021
Hey Star, just wanted to let you know that I've revised the calculations and the two cases are now essentially the same. Your solution is absolutely correct. Thank you very much!
Star Strider
Star Strider am 17 Apr. 2021
As always, my pleasure!
I very much appreciate your compliment, and for following up on this!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by