フィルターのクリア

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 Center および File ExchangeVisualization 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