0
我有一個有少量噪聲成分的圖。我打算從該圖中選擇數據,最好超過閾值,在我的情況下,我打算將它保持在Y軸上的2.009。並繪製只在它上面的線條。如果有什麼下面我將要繪製它爲0 我們可以在圖中選擇並繪製高於閾值的值
t1=t(1:length(t)/5);
t2=t(length(t)/5+1:2*length(t)/5);
t3=t(2*length(t)/5+1:3*length(t)/5);
t4=t(3*length(t)/5+1:4*length(t)/5);
t5=t(4*length(t)/5+1:end);
X=(length(prcdata(:,4))/5);
a = U(1 : X);
b = U(X+1: 2*X);
c = U(2*X+1 : 3*X);
d = U(3*X+1 : 4*X);
e = U(4*X+1 : 5*X);
figure;
subplot (3,2,2)
plot(t1,a);
subplot (3,2,3)
plot(t2,b);
subplot(3,2,4)
plot(t3,c);
subplot(3,2,5)
plot(t4,d);
subplot(3,2,6)
plot(t5,e);
subplot(3,2,1)
plot(t,prcdata(:,5));
figure;
A=a(a>2.009,:);
plot (t1,A);
此代碼會將數據看(圖中爲5每2.8秒,我打算使用第一2.8秒的閾值。此外,我有另外的代碼,但我只是不知道,如果它的工作原理,因爲它把將要分析
figure;
A=a(a>2.009,:);
plot (t1,A);
for k=1:length(a)
if a(k)>2.009
plot(t1,a(k)), hold on
else
plot(t1,0), hold on
end
end
hold off
感謝你爲這個。用這個你的意思是說它會更快?我會試試看,謝謝。 – Matlaber
當我運行thsi代碼時出現錯誤 使用。* 時出現錯誤矩陣尺寸必須一致。 al(第62行)中的錯誤 plot_vals = a。* A; %乘以邏輯向量,這將無效值設置爲 0,並保留有效值不變 – Matlaber
哦,我做了一個虛擬編輯。 – Durkee