想用自己的数据,用matlab做出这样的图:
但是可能是因为初学者,自己的代码跑出来得到下面这个图:
整个图都是颠倒的,而且最重要的是坐标轴不对😭😭
以下是我的代码:
load wcoherdemosig1
subplot(2,1,1)
plot(t,x1)
title('X1 Signal')
grid on
ylabel('Amplitude')
subplot(2,1,2)
plot(t,y1)
title('Y1 Signal')
ylabel('Amplitude')
grid on
xlabel('Seconds')
figure
wcoherence(x1,y1,1000)
figure
mscohere(x1,y1,500,450,[],1000)
不知道代码该怎么改鸭,麻烦大家帮帮忙😭😭
【以下回答由 GPT 生成】
你的代码出现的问题可能是由于信号的顺序错误导致的。调整信号顺序可以解决您遇到的问题。 以下是修改后的代码,并附上了注释说明每个步骤的作用:
load wcoherdemosig1
% 交换信号的顺序
x1 = wcoherdemosig1.y1;
y1 = wcoherdemosig1.x1;
% 绘制图形
subplot(2,1,1)
plot(t,x1)
title('X1 Signal')
grid on
ylabel('Amplitude')
subplot(2,1,2)
plot(t,y1)
title('Y1 Signal')
ylabel('Amplitude')
grid on
xlabel('Seconds')
% 生成小波相干分析图像
figure
wcoherence(x1,y1,1000)
% 生成幅度-频率图像
figure
mscohere(x1,y1,500,450,[],1000)
希望这能解决您遇到的问题!如果还有其他问题,请随时提问。