Two Signals on one graph? Difference between two signals?

76 ビュー (過去 30 日間)
Marwan
Marwan 2011 年 7 月 21 日
コメント済み: Walter Roberson 2017 年 5 月 24 日
Hello all;
I am working on two EEG signals (channel 5 & channel 13): f_c5(j,:) =abs(fft(t5(j,:),L)); f_c13(j,:) =abs(fft(t13(j,:),L));
And I am trying to find an equation that allow me to draw both signal on the same graph.
Also I would like to draw a graph presenting the difference between both of them.
Does anybody have any idea about it?
Many Thanks, Marwan

回答 (3 件)

the cyclist
the cyclist 2011 年 7 月 21 日
Here are two ways.
x = 1:10;
y1 = 2*x;
y2 = 3.5*x;
% Multiple plot commands, with "hold" on
figure
hold on
plot(x,y1,'r');
plot(x,y2,'b');
plot(x,y2-y1,'g');
% Multiple lines in one plot command
figure
plot(x,y1,x,y2,x,y2-y1);

Murthy
Murthy 2011 年 9 月 14 日
Hi.
What should we do when y1 and y2 are not defined on common x but different x values. Say x1= 1:10:100; and x2 = 0.1:0.05:300
How can I plot the difference of y1 and y2?
  2 件のコメント
Jan
Jan 2011 年 9 月 14 日
Simply fill the shorter of y1 or y2 with NaNs, such that both vectors have the same size again.
Walter Roberson
Walter Roberson 2011 年 9 月 14 日
Jan, if the x coordinates are not aligned on the same interval, subtraction is not going to be meaningful.
Murthy, you will need to interpolate (such as by using interp1()) to a common interval over the shared range and do the subtraction on the interpolated data. In the particular example you give, the interpolation could be done by subsampling of x2, x2(1*20:10*20:100*20) but it would be easy to construct examples where interp1() was needed.

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


Meth Hathemi
Meth Hathemi 2017 年 5 月 24 日
hello Sir i have a simulate problem could you find a solution and send me the code of arduino board and matlab? PLEASE methlouthihathemi@gmail.com

カテゴリ

Help Center および File ExchangeEEG/MEG/ECoG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by