フィルターのクリア

plotting three curves in the same plot

2 ビュー (過去 30 日間)
Salma fathi
Salma fathi 2022 年 6 月 8 日
コメント済み: Sajid Afaque 2022 年 6 月 8 日
I have plotted the follwing two curves as in the image below (fig2).
For the curve in red I have used a matlab generated code to do some curve fitting for it and got the curve in the below image (fig1).
Now I would like to be able to add the fitted curve to the plot in fig2 for comparison reasons, is there a way to do that?
thank you in advance,
  1 件のコメント
KSSV
KSSV 2022 年 6 月 8 日
YEs, you can plot. Read about hold on

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

回答 (1 件)

Sajid Afaque
Sajid Afaque 2022 年 6 月 8 日
編集済み: Sajid Afaque 2022 年 6 月 8 日
yeah you can use hold on before curve fitting
or
alternatively
figure(2); %the intended figure number on which you need plot
hold on
plot("your data")
  2 件のコメント
Sajid Afaque
Sajid Afaque 2022 年 6 月 8 日
your this line is creating a new figure
figure( 'Name', 'untitled fit 1' );
hence you are not able to get the plot on the same figure
Sajid Afaque
Sajid Afaque 2022 年 6 月 8 日
i can no longer see your comment (why did you delete it)
you can also use this
%in the first section
fh = figure;
ax= axes('Parent',fh);
hold(ax,'on');
%then your two plots
plot(ax,'plot 1')
plot(ax,'plot 2')
%% then you can apply optimisation
%and now the fitted plot
plot(ax,'plot 3')
fh.Name = 'khan 1'; %you can name your figure

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

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by