필터 지우기
필터 지우기

Plot two sparameters in one Smith Chart

조회 수: 4 (최근 30일)
Nils
Nils 2023년 7월 28일
편집: Nils 2023년 7월 31일
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