How to remove spurious lines?

5 ビュー (過去 30 日間)
tandemuse
tandemuse 2021 年 4 月 15 日
コメント済み: Star Strider 2021 年 4 月 17 日
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])

採用された回答

Star Strider
Star Strider 2021 年 4 月 15 日
Sort ‘velocity’:
[velocity, idx] = sort(velocity);
figure
plot3(Freqs,velocity,filtered(idx))
ylim([-2 0])
xlim([2.5 15])
grid on
producing:
.
  8 件のコメント
tandemuse
tandemuse 2021 年 4 月 17 日
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 2021 年 4 月 17 日
As always, my pleasure!
I very much appreciate your compliment, and for following up on this!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by