graph fitresult breaks weirdly in plot..?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
hey,
I'm trying to plot this data like this:
x=[0.1, 0.5, 1, 1.5, 2.5, 3, 3.3, 3.5, 3.7, 4, 4.5, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 65, 70, 75, 80, 90, 110, 250, 400, 650, 1000]*1e3;
y=[0.0351,0.1730,0.3280,0.4640,0.6552,0.7219,0.7547,0.7747,0.7927,0.8160,0.8488,0.8756,0.9160,0.9584,0.9798,1.0000,0.9997,0.9822,0.9517,0.9145,0.8749,0.8556,0.8355,0.8155,0.7957,0.7538,0.6800,0.3479,0.1913,0.0622,0.0416];
[xData, yData] = prepareCurveData( x, y);
ft = fittype( '((2*pi*x*a)/sqrt(1+(2*pi*x*a)^2))*(1/sqrt(1+(2*pi*x*b)^2))', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [-Inf 1e-06];
opts.StartPoint = [0.107005609113855 0.921912151588772];
opts.Upper = [Inf 3e-06];
[fitresult, gof] = fit( xData, yData, ft, opts );
figure( 'Name', 'untitled' );
h = semilogx( xData, yData , '.');
hold on;
plot( fitresult);

somehow, matlab creates this break in the fitresult, and ignores the second dot in the data.
can you help me understand why and how to fix it?
0 件のコメント
回答 (1 件)
KALYAN ACHARJYA
2019 年 6 月 4 日
編集済み: KALYAN ACHARJYA
2019 年 6 月 4 日
somehow, matlab creates this break in the fitresult, and ignores the second dot in the data?.
Second dot id the part of fitting curve.
Both are two different plot, fitting curve is with red points as shown in following code
x=[0.1, 0.5, 1, 1.5, 2.5, 3, 3.3, 3.5, 3.7, 4, 4.5, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 65, 70, 75, 80, 90, 110, 250, 400, 650, 1000]*1e3;
y=[0.0351,0.1730,0.3280,0.4640,0.6552,0.7219,0.7547,0.7747,0.7927,0.8160,0.8488,0.8756,0.9160,0.9584,0.9798,1.0000,0.9997,0.9822,0.9517,0.9145,0.8749,0.8556,0.8355,0.8155,0.7957,0.7538,0.6800,0.3479,0.1913,0.0622,0.0416];
[xData,yData]=prepareCurveData(x,y);
ft=fittype('((2*pi*x*a)/sqrt(1+(2*pi*x*a)^2))*(1/sqrt(1+(2*pi*x*b)^2))', 'independent', 'x', 'dependent', 'y' );
opts=fitoptions( 'Method','NonlinearLeastSquares' );
opts.Display='Off';
opts.Lower=[-Inf 1e-06];
opts.StartPoint=[0.107005609113855 0.921912151588772];
opts.Upper=[Inf 3e-06];
[fitresult,gof]=fit(xData,yData,ft,opts );
figure('Name','untitled');
h=semilogx(xData,yData,'.');
hold on;
plot(fitresult,'r*');
grid on;

0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!