error with graphing exp function

조회 수: 6 (최근 30일)
seldiora
seldiora 2019년 4월 11일
편집: seldiora 2019년 4월 11일
in my code I tried having e to some negative power and graph it but it's not working, any help?
r = 0.5; l=4;
%%given: A(1) and A(2) are two numbers from a vector, and r(1) and r(2) are two other numbers from another vector
vct = A(1)*exp(r(2)*x)+ A(2)*exp(r(1)*x);
x = 0:2:20
figure
expfunc = exp(-x*r/l) %%I want e^(-x*r/l) for that part
plot(x,vct/0.5*(1-expfunc)) %%overall equation should be: vct/0.5*(1-e^(-x*r/l))
  댓글 수: 7
James Tursa
James Tursa 2019년 4월 11일
I could fix your code so it didn't generate errors, but it might not be correct for the problem you are trying to solve. Can you give us the actual wording of the assignment?
seldiora
seldiora 2019년 4월 11일
so, I want to graph the current for an inductor. [http://hyperphysics.phy-astr.gsu.edu/hbase/electric/imgele/indt.png] However since the voltage (vct) varies with time, I want to use vct/r*... [the rest is in the image]

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by