Compute error between two graphs, each graph contains point data forming multiple curves.

I have a experimental x-y data which forms multiple intersecting and non-intersecting curves. I then have another x-y data which comes from simulation containing similar x-y data. How to I compute the error between those two graph. In the end, I want to match the experimental x-y data with the simulation x-y data.

5 个评论

Are the number of data points in each set of (x,y) data the same? Do the x-coordinate data match for all data sets?
No, the datasets are different. Each dataset when plotted looks like multiple overlapping curves. What I want to know is if I have two different dataset, how close are they to each other, or in other words, do they match with each other. The trend should match, one dataset can have sparse points as compared to other.
Here is the example of two sample data set I want to correlate.
FYI: The data cannot be upsampled or downsampled as the dataset length varies for eah dataset
Very well, then please comment on one or both of the answers below.

请先登录,再进行评论。

回答(2 个)

There are a few ways to do it.
x=linspace(0, 2*pi);
f = 3.5*sin(2*x); % Fit model
y = f+randn(size(x)); % Experimental data
scatter(x,y), hold on
plot(x,f, 'k-'), grid on
df = abs(f)-abs(y); % The difference (Error)
figure
plot(1:numel(x), df)
title('Error')
ylabel('Error')
xlabel('Data orders')
grid on

类别

帮助中心File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

提问:

2023-1-8

评论:

2023-1-20

Community Treasure Hunt

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

Start Hunting!

Translated by