Plot two sparameters in one Smith Chart
4 views (last 30 days)
Show older comments
Hi,
I want to add a Maker to my smith plot in the new app designer.
Before the app designer, I used the hold on function to draw a new smith chart containing only one point with i enlarged.
But now the hold on function doesn't work with the method that was given me (https://de.mathworks.com/matlabcentral/answers/2001822-matlab-opens-smithplot-in-new-figure)
How can you add and remove a single point on the smith plot function?
Or how can I plot multiple smith plots with individual handles in one chart?
I attached the code in from my test program, so you can see what I'm trying to accomplish
% Code that executes after component creation
function startupFcn(app)
d = dipole;
freq = linspace(60e6,90e6,200);
app.s = sparameters(d,freq);
end
function ButtonPushed(app, event)
sxx = rfparam(app.s,1,1)
app.UIFigure;
axes(app.UIAxes)
hg = smithplot(app.s,'Parent',app.UIAxes);
end
function SliderValueChanged(app, event)
value = app.Slider.Value;
% add a marker at the value freq and delete the old one
end
0 Comments
More Answers (1)
dpb
on 28 Jul 2023
Edited: dpb
on 29 Jul 2023
You didn't save the handle to the chart when you created by making it an app property; hence you don't have it available in the callback function.
I don't see any indication that you set 'hold on' in the given axes, either.
You're not being careful to return handles to all the objects when you create them; that's bad practice, especially in an AppDesigner app that is gui-driven by callbacks; you have little control over what the user does on the gui so to control which is the currently active object when you don't code every call explicitly to interact with the intended axis, or other object.
It'll all work when you clean up the code to be certain you're interacting with the desired component (and, most importantly, save the needed object handles to shared properties so they'll be available in your callback function(s) when you need them).
0 Comments
See Also
Categories
Find more on Visualization and Data Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!