Expression (equation)

조회 수: 1 (최근 30일)
Jan
Jan 2011년 12월 8일
Hello, how to define an expression, for example 1-e^(-At) where I can define and change parameters A and t and than figure changes of the curve in a graph.
Thanks

채택된 답변

Paulo Silva
Paulo Silva 2011년 12월 8일
Simplest version I can think of
t=0:0.1:100; % Time vector
A=0.1; % Value of A that you can change
plot(t,1-exp(-A(n)*t)) % Represent it on a figure
If you place the cursor on the value of A you can try several values using the Editor tools (look on the tools of your editor window - 1.0 + ... press those symbols and the script runs with a new value for A)
Just for fun here's a version using subplots
clf
t=0:0.1:10;
A=[0.01 0.1 0 1];
for n=1:4
subplot(2,2,n)
plot(t,1-exp(-A(n)*t))
title(['A=' num2str(A(n))])
end
  댓글 수: 9
Paulo Silva
Paulo Silva 2011년 12월 8일
It's just basic math, you use the Product block with inputs A and t and connect that block output to the Math Function block
Jan
Jan 2011년 12월 8일
thx :)

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 12월 8일
And to add on to Paulo's example:
t=0:0.1:100; % Time vector
A=0.1;
y = 1-exp(-A*t); % Value of A that you can change
H = figure;
plot(t,y)
linkdata(H,'on');
shg;
pause(2) %watch the magic in 2 seconds
A = .8;
y = 1-exp(-A*t);
if you want it to automagically update when you change A or y.
  댓글 수: 3
Jan
Jan 2011년 12월 8일
Thanks a lot Sean :)
Jan
Jan 2011년 12월 8일
Is it possible to model it in the Simulink?

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

카테고리

Help CenterFile Exchange에서 Exponents and Logarithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by