Solve for two 1024x1024 variables using two equations.

pic1 = double (Pic1);
pic3 = double(Pic3);
pic4 = double(Pic4);
ILE = 1;
E = pic1./ILE;
VT = 0.025;
IL = 1;
I1 = pic3 - B*IL;
I2 = pic4 - B*IL;
jp=0.038;
V1(1:1024,1:1024)=0.616185;
V2(1:1024,1:1024)=0.575044;
%Equation 1
%(V1-VT.*log(I1)) = -((VT).*log(A)) -(jp.*B)+ (I1.*(V1 - VT.*log(I1)+ jp.*B +VT.*log(A)));
equation1 = (V1-VT.*log(I1))+((VT).*log(A)) +(jp.*B)- (I1.*(V1 + VT.*log(I1)- jp.*B - VT.*log(A)));
%Equation 2
%V2-VT.*log(I2) = -((VT).*log(A)) -(jp.*B) + (I2.*(V2 - VT.*log(I2)+ jp.*B +VT.*log(A)));
equation2 = V2-VT.*log(I2)+((VT).*log(A)) +(jp.*B) - (I2.*(V2 + VT.*log(I2)- jp.*B - VT.*log(A)));
I want to solve for the variables A and B (1024x1024) from the two equations? need guidance in coding using the two equations.

Answers (1)

Torsten
Torsten on 10 Aug 2016
Edited: Torsten on 10 Aug 2016
Your equations are linear in log(A). So first solve (taking paper and pencil) for log(A) as an expression depending on B. Then insert this expression for log(A) e.g. in equation 1. You've now reduced your problem to solving one (nonlinear) equation in B. I'd suggest you solve this one element after the other for B using MATLAB's "fzero". This may take a while since you have 1024x1024 single equations to solve.
Best wishes
Torsten.

3 Comments

@Torsten
I have solved for log(A).
log(A) = (V1-(VT.*log(I1))+(jp.*B)-(V1*I1+I1.*VT.*log(I1))- (I1.*jp.*B))./(VT.*(I1-1));
how to substitute into equation 1 via MATLAB? and use "fzero"?
I get another expression for log(A) from your first equation, but however ...
You have to insert the correct expression manually into equation (2) and solve for the elements of B one element after the other using MATLAB's "fzero".
Best wishes
Torsten.
I missed the dependence on B in I1 and I2.

This question is closed.

Asked:

on 10 Aug 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!