Borrar filtros
Borrar filtros

Plot two sparameters in one Smith Chart

4 visualizaciones (últimos 30 días)
Nils
Nils el 28 de Jul. de 2023
Editada: Nils el 31 de Jul. de 2023
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

Respuesta aceptada

Nils
Nils el 31 de Jul. de 2023
Editada: Nils el 31 de Jul. de 2023
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 comentario
dpb
dpb el 31 de Jul. de 2023
Editada: dpb el 31 de Jul. de 2023
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...

Iniciar sesión para comentar.

Más respuestas (1)

dpb
dpb el 28 de Jul. de 2023
Editada: dpb el 29 de Jul. de 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).

Categorías

Más información sobre Visualization and Data Export en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by