MATLAB Answers

0

How do I find the difference between two plots when the dimension of two matrices are not the same?

Asked by Melody Hsieh on 8 Dec 2018 at 19:37
Latest activity Answered by Image Analyst
on 9 Dec 2018 at 0:07
Hi everyone, I'd like to find the difference between two plots (at y-axis) but I don't really know how because of the matrixes have different dimensions. The data_frequency matrix is 1x345 double and patient's threahold is 1x18 double.
I've tried using cftool to see if i could get functions from the plot but it didn't work.
% Normal threshold
load('data_frequency.mat');
figure (1)
semilogx(f,pressure);
hold on
% Patient's threshold
p_f = [3,4,8,10,20,40,80,100,200,400,800,1000,2000,4000,8000,10000,12000,15000];
p_p = [142,140,136,132,123,82,58,70,80,84,45,20,3,8,30,40,46,60];
semilogx(p_f,p_p);
xlabel('frequency (Hz)');
ylabel('sound pressure (dB)');
title('Normal hearing threshold vs patient hearing threshold');
legend('normal threshold','patient threshold');

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 9 Dec 2018 at 0:07

You unfortunately forgot to attach 'data_frequency.mat'.
But what I'd do it to interpolate the same number of points between them, like use interp1() to generate two signal arrays of 1000 points each. Then you can subtract them and multiply by delta f to get area between curves, if that's what you want.

  0 Comments

Sign in to comment.