A few questions of passing to functions, recursion and plotting
3 views (last 30 days)
Show older comments
So for my specfic question(s), I know Matlab has recursive capability as well as using fsolve to get a y value given an x with a format of y= x+e^y or some such example. And then how would I go about plotting these points along the way while solving for a specific value.
In this case I'm solving for power, but current must be used with fsolve and voltage to get the answer. And the voltage would be increased each time with a small interval(points of the plot).
I have an idea so far, you would need to pass the previous voltage and power and simply use a hill-climbing algorithim to find power. But how exactly would you pass the previous voltage and power for each?
And then once the maximum power was found using this method, how would I display this seperately on the graph of Power(y) v Voltage(x)? Where the voltage at maximum power would be less than the maximum system voltage. So for example voltage at maximum power would be 20 volts, but maxiumum voltage would be 25 volts.
The equation I would use is such

Where I would wish to solve for I(current) and use U(voltage), however I have I on both sides, so I would have to use fsolve. The ending portion with Rsh is infinity in this case so it disapears, but I still have an I on both sides, with one being in the exponential and one as a standalone.

This would be an illustration of how the overall shape of the graph would come out. Where the blue-dotted-lines would be the maximum power point. And so I would start at 0,0 and hill climb to get there using this recursive function. But again how would I get it to plot along the way and after?
I'm not asking for any specific code related directly to this. If these questions have already been answered I would really appreciate the threads if possible.
Thank you for anyone who can give me any advice.
0 Comments
Answers (1)
David Hill
on 15 Feb 2022
I=0:0.01:(Iph+Is+.01);%I cannot be >Iph+Is (based on log not going negative
U=(A*k*T*log((Iph+Is-I)/Is)-I*Rs*q)/q;%easy enough to solve for U
plot(U,I)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!