matlab - 绘制信号的导数
问题描述
我的编码遇到问题。我在一个图中有多个图。我正确地得到了我的所有图,但不幸的是,导数图在图中甚至都看不到。谁能帮忙..提前谢谢
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
:
y = diff(MHD);
z = diff(x);
plot(z,y);
相反,绘制MHD
反对的导数x
:
y = diff(MHD);
plot(x,y);
diff(x)
是一个具有所有相同值的数组。因此,您的所有值y
都绘制在沿 x 轴的同一位置。
推荐阅读
- javascript - React Native 动态 StackNavigator
- sql-server - 尝试从代理作业加载超过 50K 记录时,SSIS 包挂起
- arrays - RuntimeWarning:在 double_scalars 中遇到除以零
- java - 将列表与 hamcrest 进行比较
- web-services - 如何从 Spring Boot 端点服务返回自定义 SOAP 错误?
- rest - 访问 Gerrit REST API 的确切链接是什么?
- c - 文件中的字符串长度
- microsoft-graph-api - Microsoft graph:从组中获取邮件文件夹 ID
- c# - 启动 out-gridview 后 Winform 调整大小/缩小
- java - 我怎么可能在 onCreate() 中为我的 Session 获得错误的类?