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

조회 수: 3 (최근 30일)
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');

답변 (1개)

Image Analyst
Image Analyst 2018년 12월 9일
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.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by