How do I find the difference between two plots when the dimension of two matrices are not the same?
3 views (last 30 days)
Show older comments
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
Answers (1)
Image Analyst
on 9 Dec 2018
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
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!