represent exponential function in app designer
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alvaro Mª Zumalacarregui Delgado
le 22 Fév 2021
Réponse apportée : Abhishek Chakram
le 11 Oct 2023
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 commentaires
Réponses (1)
Abhishek Chakram
le 11 Oct 2023
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 commentaires
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!