How can I plot multiple curves in one figure using "SLM - Shape Language Modeling"?

I'm trying to plot at least two curves into the same figure with SLM. I'm totally new to matlab, so I need a little help with this. I'm into a for-loop, in every loop two sets of data points are plotted and every set needs its own fitting curve. I just tried something like this, but it didn't work.
for i = 2:2:(size(num,2)/2)
slm = slmengine(Spalte{1},Spalte{i},'plot','on','knots',10,'increasing','on', ...
'leftslope',0,'rightslope',0);
slm1 = slmengine(Spalte{1},Spalte{i+6},'plot','on','knots',10,'increasing','on', ...
'leftslope',0,'rightslope',0);
figure
p = plotslm(slm);
hold on
p1 = plotslm(slm1);
end
Would be great if anyone could help!
Thanks and cheers,
Karin

3 件のコメント

Matt J
Matt J 2012 年 12 月 14 日
Even if we had SLM and could run your code, there's no certainty we'd get the same outcome as you. Explain what "didn't work" means and what you're seeing that you don't like.
The plot commands look like they should work to me, assuming slm and slm1 were correctly generated.
Karin
Karin 2012 年 12 月 14 日
When I run the code, I get five single windows. The first and the second are generated from the slm = slmengine(...) lines, both with the related curves. The third one is just an empty figure, because I use the command "figure" I guess. The fourth and fifth windows look exactly like the first and the second, generated from the "plotslm"-commands. So I guess there's no need to use the figure-command, because slmengine and plotslm just create figures.
Image Analyst
Image Analyst 2012 年 12 月 14 日
Try to contact the author, John D'Errico.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2012 年 12 月 14 日
If you want to control which figure window the plot is made in, e.g, if you have a prior figure handle, H, you could try,
H=figure; hold on
for i = 2:2:(size(num,2)/2)
slm = slmengine(Spalte{1},Spalte{i},'plot','on','knots',10,'increasing','on', ...
'leftslope',0,'rightslope',0);
slm1 = slmengine(Spalte{1},Spalte{i+6},'plot','on','knots',10,'increasing','on', ...
'leftslope',0,'rightslope',0);
figure(H);
plotslm(slm);
figure(H)
plotslm(slm1);
end

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

質問済み:

2012 年 12 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by