How to plot the error between two signals?

I did the filtering of an EEG signal using fir filter then i implement this fiter in c langage. Now i need to plot the error between the to filter but i don't know how to do that. Can anyone help me please.

6 个评论

It's not clear whether your question is about plotting commands or signal processing techniques. Please clarify.
I have 2 signals and i want to plot the error between the 2
... and the error has to be plotted in C language ?
How do you define "error" for your purposes ?
NO i want to plot this with Matlab . i tried this :
load('C:\Users\del.dell-PC\pfe\base de donnée\patient sans crise\chb23_16_edfm.mat')
deriv1=(val(1,:)-0)/2.559375;
Fs=256;
t1=(0:length(deriv1)-1)/Fs; %valeur du temps de tout échantillon%
d1=designfilt('lowpassfir','PassbandFrequency',0.45,'StopbandFrequency',0.5,'PassbandRipple',3,'StopbandAttenuation',60,'DesignMethod','equiripple');
a = filtfilt(d1,deriv1);
x=[-41.023197 -29.971899 -6.535204 6.053481 .... ];
figure(1),hold on;
plot(deriv1);
plot(a,'LineWidth',1);
hold off;
figure(2),hold on;
plot(deriv1);
plot(x,'LineWidth',1);
hold off;
figure(3),hold on;
plot(a);
plot(x,'LineWidth',1);
hold off;
X are the values of filtered signal with my c code and a the result of filter with Matlab
And i want to know is there a way to plot the error i mean by that the differnce between the two signals.

请先登录,再进行评论。

 采纳的回答

x = 1:10;
y1 = 2*x;
y2 = 3.5*x;
% error
dy = y2-y1 ;
% Multiple plot commands, with "hold" on
figure
hold on
plot(x,y1,'r');
plot(x,y2,'b');
plot(x,dy,'g');
%
legend('Signal1','Signal2','error')

3 个评论

I don't understand this part .Can you explain this to me please?
x = 1:10;
y1 = 2*x;
y2 = 3.5*x;
KSSV needed some data for illustration purposes, so he created a range of x from 1 to 10, and created one line as 2*x and a second line as 3.5 * x. In your actual code you would replaces those three lines with your own data.
Ok i understand now.thanks

请先登录,再进行评论。

更多回答(0 个)

类别

标签

Community Treasure Hunt

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

Start Hunting!

Translated by