represent exponential function in app designer
조회 수: 1 (최근 30일)
이전 댓글 표시
How can I put the initial condition to the functions y1 and y2? Because the interface doesn't draw in the axes the function that I want and maybe it is due to the fact that my code doesn't have the initial condition, this is my code:
P = app.P.Value;
Q = app.Q.Value;
Xo = app.Xo.Value;
Yo =app.Yo.Value;
a = app.a.Value;
b = app.b.Value;
Ky = Yo-P/a;
Kx = Xo-Q/a;
C2 = (Ky.*sqrt(a/b)+Kx)/(2.*sqrt(a/b));
C1 = Ky-C2;
x = 0:0.2:100;
y1 = (- C1*sqrt(a/b)*exp(sqrt(a*b)*x) + C2*sqrt(a/b)*exp(-sqrt(a*b)*x)) + Q/b;
plot (app.Axes,x,y1,'k')
y2 = (C1*exp(sqrt(a*b)*x) + C2*exp(-sqrt(a*b)*x)) + P/a;
hold (app.Axes, 'on');
plot (app.Axes,x,y2,'g')
hold (app.Axes,'off')
thanks!
댓글 수: 0
답변 (1개)
Abhishek Chakram
2023년 10월 11일
Hi Alvaro Mª Zumalacarregui Delgado,
It is my understanding that you want to add initial conditions to the functions y1 and y2. Here is an example for the same:
x = 1:10;
y1_initial = 0; % Intial y1 value
y2_initial = 4; % Intial y2 value
y1 = [y1_initial,cos(x)]; % Assigning intial y1 value
y2 = [y2_initial,sin(x)]; % Assigning intial y2 value
plot(y1,y2,'*');
In this example, “y1_initial” and “y2_initial” are the initial conditions for the functions “y1” and “y2”.
Best Regards,
Abhishek Chakram
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!