Plot two sparameters in one Smith Chart

4 次查看(过去 30 天)
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

采纳的回答

Nils
Nils 2023-7-31
编辑:Nils 2023-7-31
Hi all,
To plot two charts on one axis, you can modify the hold function.
But thanks for your answer, dpb :)
hg = smithplot(app.sparameters,'Parent',app.UIAxes);
hold(app.UIAxes,"on");
hg2 = smithplot(app.sparameters,'Parent',app.UIAxes);
  1 个评论
dpb
dpb 2023-7-31
编辑:dpb 2023-7-31
You don't "modify" hold, it is called with the optional (but necessary in this occasion as I said) target axes handle that wasn't in the code outline shown...

请先登录,再进行评论。

更多回答(1 个)

dpb
dpb 2023-7-28
编辑:dpb 2023-7-29
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).

类别

Help CenterFile Exchange 中查找有关 Visualization and Data Export 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by