solving an unknown 1024x1024 variable

pic1 = double (Pic1);
pic2 = double(Pic2);
pic3 = double(Pic3);
pic4 = double(Pic4);
ILB = 1;
B = pic1./ILB;
ILC = 0.2;
VC(1:1024,1:1024)= 0.581695;
VT = 0.025;
C = (pic2 - B*ILC)./(exp(VC./VT));
IL = 1;
V1 = VT*log((pic3 - B*IL)./(C));
V2 = VT*log((pic4 - B*IL)./(C));
jp=0.038;
Vp1(1:1024,1:1024)=0.616185;
Vp2(1:1024,1:1024)=0.575044;
syms A
eqn = (((Vp1-V1))./(A.*exp(V1/VT)-jp)).*(A*exp(V2/VT)-jp) == Vp2-V2;
Asol = solve(eqn, A);
A= subs(Asol, {A}, {A});
Unable to solve for variable A?

 採用された回答

Walter Roberson
Walter Roberson 2016 年 8 月 8 日

1 投票

In MATLAB, a resolved symbolic variable is always a scalar, so you are asking solve() to find a single value that simultaneously satisfies over a million different equations.
A = sym('A', size(Vp1));
eqn = (((Vp1-V1))./(A.*exp(V1/VT)-jp)).*(A*exp(V2/VT)-jp) == Vp2-V2;
Asol = solve(eqn, A);

2 件のコメント

shoba
shoba 2016 年 8 月 8 日
Sorry,I am not able to get any output. Status: Busy. Why?
Hope to get value for A that is 1024 x 1024 and ouput into an image.
Walter Roberson
Walter Roberson 2016 年 8 月 8 日
syms A_ Vp1_ V1_ V2_ Vp2_
eqn = (((Vp1_ - V1)) . /(A_ .* exp(V1_/VT)-jp)) .* (A_ .* * exp(V2_/VT)-jp) == Vp2_ - V2_;
Asol = solve(eqn, A_);
A = double( subs(Asol, {Vp1_ Vp2_ V1_ V2_}, {Vp1, Vp2, V1, V2}) );
imshow(A)

サインインしてコメントする。

その他の回答 (2 件)

Torsten
Torsten 2016 年 8 月 8 日

1 投票

A linear equation in A can easily be solved analytically:
A=jp.*((Vp1-V1)-(Vp2-V2))./((Vp1-V1).*exp(V2-VT)-(Vp2-V2).*exp(V1/VT))
Best wishes
Torsten.

4 件のコメント

shoba
shoba 2016 年 8 月 8 日
@Walter, I need your advice.
@Torsten, I could output an image with a single colour.
Torsten
Torsten 2016 年 8 月 8 日
Yes, this is correct for your settings since the elements of Vp1 and Vp2 are all the same.
Best wishes
Torsten.
shoba
shoba 2016 年 8 月 8 日
@Walter Sorry,I am not able to get any output. Status: Busy. Why?
Hope to get value for A that is 1024 x 1024 and output into an image.
The numerical values for Vp1 and Vp2 are different.
Walter Roberson
Walter Roberson 2016 年 8 月 8 日
It is past my bedtime. I am off to sleep.

サインインしてコメントする。

Steven Lord
Steven Lord 2016 年 8 月 8 日

1 投票

You could try defining A to be a symbolic matrix, but solving a system of over a million symbolic equations is likely to take quite a while.
A = sym('A', [1024 1024]);

Community Treasure Hunt

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

Start Hunting!

Translated by