I have 2 different sets of values corresponding to a magnetization curve. My problem is that I cannot actually compute the mean values of the curves. I am thinking I should use some kind of interpolation, but I don't know how.
My code so far:
I = [ 0 1.1 4 9.5 15.3 19.5 23.1 26 28.2 30.8 33.3 35.9];
E_up = [ 5.8 10.5 28 60.3 85.5 100.3 108 113.2 117 120.5 123.5 126];
Iw = [ 34 31.5 28.2 23.9 19.9 16.1 13 8.1 3.5 1.2 0 NaN];
E_down = [124.6 122.5 118.8 112.2 103.9 93.1 81.6 59.1 29.6 14.5 9.5 NaN];
n = 800/1500;
plot(I,E_up,Iw,E_down)
grid on
legend ('up', 'down')
%loop for mean values
for ii = 1:length(I)
E1(ii) = ((E_down(13-ii)));
E2(ii) = E_up(ii);
E4(ii) = mean([E1(ii),E2(ii)]);
I2(ii) = Iw(13-ii)
I3(ii) = mean([I2(ii),I(ii)])
end
hold on
plot(I3,E4,'r-')
plot(I3(7),E2(7),'co',I3(7),E1(7),'ro')
plot(I3,E1,'c-',I3,E2,'g-')
Here is the graph I am getting and its totally wrong
*edit The problem is I am actually getting the average curve of cyan and light green instead of blue and dark green.
A
, your "mean curve" is simplymean(A,2)
. For the two case, getmean(A(:,[1 5]),2)