Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Please Help!
Date: Tue, 30 Nov 2010 03:24:05 +0000 (UTC)
Organization: University of Colorado Denver
Lines: 58
Message-ID: <id1qol$t4u$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1291087445 29854 172.30.248.37 (30 Nov 2010 03:24:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Nov 2010 03:24:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2492023
Xref: news.mathworks.com comp.soft-sys.matlab:691067

Hello,

I'm not very adept at using MatLab and have been struggling with this problem for hours now. I have two equations I am trying to solve for I and V (Current and Voltage):

I = Il-Io*(exp((V+I*Rs)/a)-1)
V = (Mp*I*Rl)/Ms

I have tried to set up a while loop and graphically solve the equations, however, I can't get past the same error:

??? Undefined function or method
'intercept' for input arguments of type
'double'.

Error in ==> Pleasework at 21
    ind_Inew=intercept(I,eq1,eq2);

Here is my code that I'm using:

%Enter the given variables
Mp=4;
Ms=2;
Rs=0.533;
a=1.005;
Il=4.543;
Io=2.353*10^-9;
Rl=6;
    
%Solve for V and I
V_start=10; %Initial guess for V
change=1;
V=V_start;
        
while change>0.001
    %Graphically solve the first equation
    I=0.01:0.0001:10;
    eq1=Il-Io*(exp((V+I*Rs)/a)-1);
    eq2=I;
    
    ind_I=intercept(I,eq1,eq2);
    I=I(ind_I);
    
    %Graphically solve the second equation
    V=2:0.0001:40;
    eq1=(Mp*I*Rl)/Ms;        
    eq2=V;
    
    ind_V=intercept(V,eq2,eq1);
    V=V(ind_V);
    change=abs(V-V_start);
    V_start=V;
end
    
    V
    I

Any help would be much appreciated. I have been struggling on this problem for awhile now. Thanks.

Kevin