フィルターのクリア

Curve Fit plotting error.

11 ビュー (過去 30 日間)
Travis Girton
Travis Girton 2020 年 12 月 11 日
回答済み: Shiva Kalyan Diwakaruni 2021 年 1 月 11 日
I am trying to use the Curve Fitting toolbox and I have generated a fit, but as soon as add anything else to the graph it seems to have issues.
I'm new to using this toolbox and not very good with matlab so I'm probably using it wrong. I just did a save to workspace instead of generating the code becuase I honestly don't know how to get it to work any other way. Does it have something to do with the logarithmic axis? any tips or suggestions would be helpful.
Code that I'm using
semilogx(f,v,'k.')
hold on
plot(fit3)
  2 件のコメント
VBBV
VBBV 2020 年 12 月 11 日
What are you adding to? To the fitted curve ? Or the original data ? If you add to any of the two you may need to perform curve fitting operation again to remove differences as in your 2nd plot
Travis Girton
Travis Girton 2020 年 12 月 11 日
D = Lab9DataS1;
f1 = D{:,1};
v1 = D{:,2};
f2 = D{:,3};
v2 = D{:,4};
semilogx(f1,v1,'r.');
hold on
plot(fit1,'b');
semilogx(f2,v2,'k.');
plot(fit2)
This is essentially it. The 'fit1' and 'fit2' are just the 1x1 cfit files that I saved to the workspace from the toolbox. It worked in the toolbox and with one set of data, just not all together.

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

回答 (1 件)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni 2021 年 1 月 11 日
Hi,
Using a 'hold on' before 'semilogx' can generally be the reason behind this. Try avoiding it and plot other objects in the figure using figure or axes handles.
It says that, if you attempt to add a "semilogx" plot to a linear axis mode graph with "hold on", the axis mode remains as it is and the new data plots as linear.
As a workaround, try setting the axes's "XScale" property to "log" before using the "hold on" command:
>> set(gca,'XScale','log');
This will prevent "hold" from overwriting the logarithmic axes.

カテゴリ

Help Center および File ExchangeFit Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by