Matlab 绘制信号的导数
我在编码方面遇到了一个问题。我在一个图中有多个图。我得到的所有图都是正确的,但不幸的是,导数图在图中甚至不可见。有人能帮忙吗。。提前谢谢Matlab 绘制信号的导数,matlab,derivative,Matlab,Derivative,我在编码方面遇到了一个问题。我在一个图中有多个图。我得到的所有图都是正确的,但不幸的是,导数图在图中甚至不可见。有人能帮忙吗。。提前谢谢 close all clear all clc load('2019-01-31-structTFMRI-Proband04-Ivan.mat') fs=structTFMRI.SigInfo.fs; %Sampling frequency in Hz %PlotLead = 10; %ECG lead to plot (only used for 12-l
close all
clear all
clc
load('2019-01-31-structTFMRI-Proband04-Ivan.mat')
fs=structTFMRI.SigInfo.fs; %Sampling frequency in Hz
%PlotLead = 10;
%ECG lead to plot (only used for 12-lead ECG)
%% 12-lead ECG (Outside and Inside MRI)
ECGOutSingle = structTFMRI.ECGMRI.ECG12OutSingle; %820 Samples per beat (~800ms), 120 beats, 12 leads
ECGInSingle = structTFMRI.ECGMRI.ECG12InSingle; %820 Samples per beat (~800ms), 182 beats, 12 leads
%Plot the data
figure;
hold on
for PlotLead=4:4
t=(0:1:length(ECGOutSingle(:,1,PlotLead))-1)/fs; %Time vector for plot to have x-axis in seconds
%plot(t,ECGOutSingle(:,1,PlotLead))
%plot(t,ECGInSingle(:,1,PlotLead))
plot(t,ECGInSingle(:,1,PlotLead)-ECGOutSingle(:,1,PlotLead)) %MHD signal
MHD = ECGInSingle(:,1,PlotLead)-ECGOutSingle(:,1,PlotLead);
x = 1:length(ECGInSingle);
[Zi,Zi_idx,Xi,Xi_idx,Bi,Bi_idx] = getZXB(MHD);
y = diff(MHD);
z = diff(x);
plot(z,y);
plot(x,MHD);
plot(x(Bi),MHD(Bi),'r*');
plot(x(Xi),MHD(Xi),'g*');
plot(Zi_idx,Zi,'b*');
end
您正在绘制MHD的导数与x的导数: 相反,绘制MHD对x的导数: diffx是一个具有所有相同值的数组。因此,所有y值都沿x轴绘制在同一位置。所有值都是NaN吗?因为您没有提供,所以无法判断,但是没有绘制NaN值,所以这是一个可能的诊断。
y = diff(MHD);
z = diff(x);
plot(z,y);
y = diff(MHD);
plot(x,y);