How do you graph two equations on the same graph?

1 Ansicht (letzte 30 Tage)
Nathan Donatell
Nathan Donatell am 31 Okt. 2019
Here is the code that I am using for my two equations I am able to graph them separately but when I graph them together my graph is not correct. I am trying to figure out where the two equations intersect.
plot 1
x = 0:.1:10;
I = (-1/5000)*x+(.0018);
plot(x,I)
plot 2
q=1.6022e-19
C=28.73
T=273+C
k=1.3806e-23
Is=1.0e-12
V= 0:0.01:9
n=1
Vt=(k*T)/q
Id=Is*((exp(V/(n*Vt)))-1)
plot(V,Id)

Antworten (2)

Star Strider
Star Strider am 31 Okt. 2019
Considering your present code, use the hold function.
Using your code:
x = 0:.1:10;
I = (-1/5000)*x+(.0018);
plot(x,I)
hold on % hold on
q=1.6022e-19
C=28.73
T=273+C
k=1.3806e-23
Is=1.0e-12
V= 0:0.01:9
n=1
Vt=(k*T)/q
Id=Is*((exp(V/(n*Vt)))-1)
plot(V,Id)
hold off % hold off
Experiment to get the result you want.

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 31 Okt. 2019
Hi,
x = 0:.1:10;
I = (-1/5000)*x+(.0018);
plot(x,I), hold on
%plot 2
q=1.6022e-19;
C=28.73 ;
T=273+C;
k=1.3806e-23 ;
Is=1.0e-12 ;
V= 0:0.01:9;
n=1 ;
Vt=(k*T)/q ;
Id=Is*((exp(V/(n*Vt)))-1) ;
plot(V,Id), legend('x vs. I', 'V vs. Id')
% as two subplots
figure
subplot(211)
plot(x, I)
subplot(212)
plot(V, Id)
Check the values of coefficients/parameters. They seem to be incorrectly typed in.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by