MATLAB: Finding teh intersection between 2 curves.

intersection

we are asked to calculate the intersections between the 2 curves plotted below. the teachers told us to use the 'diff' command to calculate the difference in current between the curves and then use 'fzero' to find the value where they intersect. Unfortunately we can't find the solution can someone help us out? I also thought about using 'intersect' but can't work this out either.
thanks
code:
Ra=3.32; % [ohm]
Ke=1120; % [rpm/V]
Ke=(1120*2*pi/60)^-1; %[Vs/rad]
k = 1.38*(10^-23);
w = 50; % [rad/s]
Isc = 0.28;
T = 294;
q = 1.6*(10^-19);
Ur = (k*T)/q;
Is = 10^-8;
e = 2.71828;
N = 16;
m = 1.3286;
E=Ke*w;
Ia = Isc – (Is*(e.^(U/(m*Ur*N))-1)); %[A]
Ua=Ra*Ia+E;
U = [0, 0.39, 2.11, 3.18, 4.79, 6.29, 7.57, 8.36, 8.66, 8.76, 8.81, 8.86, 8.88, 8.92, 8.93, 8.96, 9.15];
I = [0.28, 0.28, 0.27, 0.27, 0.27, 0.26, 0.26, 0.26, 0.24, 0.23, 0.21, 0.19, 0.18, 0.16, 0.15, 0.14, 0];
plot(Ua,Ia,U,I) axis([0 10 0 0.4]) xlabel('U(V)') ylabel('I(A)') title('voltage and current')

Best Answer

I took a different approach:
Ra=3.32; % [ohm]
Ke=1120; % [rpm/V]
Ke=(1120*2*pi/60)^-1; %[Vs/rad]
k = 1.38*(10^-23);
w = 50; % [rad/s]
Isc = 0.28;
T = 294;
q = 1.6*(10^-19);
Ur = (k*T)/q;
Is = 10^-8;
e = 2.71828;
N = 16;
m = 1.3286;
E=Ke*w;
U = [0, 0.39, 2.11, 3.18, 4.79, 6.29, 7.57, 8.36, 8.66, 8.76, 8.81, 8.86, 8.88, 8.92, 8.93, 8.96, 9.15];
I = [0.28, 0.28, 0.27, 0.27, 0.27, 0.26, 0.26, 0.26, 0.24, 0.23, 0.21, 0.19, 0.18, 0.16, 0.15, 0.14, 0];
Ia = Isc - (Is*(e.^(U/(m*Ur*N))-1)); %[A]
Ua=Ra*Ia+E;
Imatch = interp1(U, I, Ua); % Find Matching ‘I’ Values For ‘Ua’
dI = I - Imatch; % Subtract To Get Zero Crossing
Ucross = interp1(dI, Ua, 0); % Calculate ‘Ua’ At Zero-Crossing
Icross = interp1(Ua, I, Ucross); % Calculate Corresponding ‘I’
figure(1)
plot(Ua,Ia,U,I)
hold on
plot(Ucross, Icross, 'pg', 'MarkerFaceColor','g')
hold off
axis([0 10 0 0.4])
xlabel('U(V)')
ylabel('I(A)')
title('voltage and current')
text(Ucross, Icross*1.05, sprintf('(%.3f, %.3f)', Ucross, Icross), 'HorizontalAlignment','center', 'VerticalAlignment','bottom')