Matlab Appdesigner for interactive plots

Hello,
I am trying to create an interactive plot GUI through AppDesigner.
I need to base the plot a given function:
I then need to generate a plot based off of the equation and what the user inputs.
I am currently struggling to code the callback for the plot button. Could somebody please tell me how (and it would greatly appreciated if you could show me complete code). This is what I have so far within a callback code for the plot button:
N=app.SinusoidsnEditField.Value;
A=app.app.AmplitudeAEditField.Value;
F=app.FundamentFreqHzDropDown.Value;
time=0:0.2:2;
syms n N
y=4*A/pi*1/(2*3-1)*sin(2*3-1)*2*pi*F*time;
plot(app.UIAxes,time,y);

3 Kommentare

Rik
Rik am 6 Okt. 2022
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
This page is now archived on the Wayback Machine.
Rik
Rik am 8 Okt. 2022
Why did you edit your question again? Does the answer somehow not work? Then you should post a comment explaining why it doesn't solve the problem.
If you don't respond, I will revert your edit again and mark the answer as accepted.
Bozza
Bozza am 10 Okt. 2022
The information is fine, the picture however is copyrighted, so please stop editing it back in...

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

chrisw23
chrisw23 am 6 Sep. 2022

0 Stimmen

I suggest to call the plot function just once (initially with default parameters at startup()). The returned object is a line.
app.sinusoidLine = plot(app.UIAxes,time,y);
Store the object as property (i.e. app.sinusoidLine).
Then change the XData and YData properties of the line in your callback function.
app.sinusoidLine.XData = time;
app.sinusoidLine.YData = y;

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 6 Sep. 2022

Bearbeitet:

am 10 Okt. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by