change color when i plot more surface fit

19 ビュー (過去 30 日間)
Giovanni Massaria
Giovanni Massaria 2022 年 10 月 18 日
編集済み: Kevin Holly 2022 年 10 月 18 日
Hi everyone, i need to change the color of the different surfaces that i found whit fit, adding a simple color command don't work, so how can i have different colors in the two surfaces? the first blue and the second red for example
fig10=figure(10);
[xData, yData, zData] = prepareSurfaceData( comfortval, cval, dval );
ft = fittype( 'poly44' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Robust = 'Bisquare';
fitresult = fit( [xData, yData], zData, ft, opts );
h1 = plot( fitresult, [xData, yData], zData );
hold on
[xData, yData, zData] = prepareSurfaceData( comfortvalBL, cvalBL, dvalBL );
ft = fittype( 'poly44' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Robust = 'Bisquare';
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
h2 = plot( fitresult, [xData, yData], zData); % if i add ,'r' at the end the programm don't work
hold on

回答 (1 件)

Kevin Holly
Kevin Holly 2022 年 10 月 18 日
編集済み: Kevin Holly 2022 年 10 月 18 日
fig10=figure(10);
xData = rand(30,1);
yData = rand(30,1);
zData = rand(30,1);
ft = fittype( 'poly44' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Robust = 'Bisquare';
fitresult = fit( [xData, yData], zData, ft, opts );
h1 = plot( fitresult, [xData, yData], zData );
h1(1).FaceColor = 'b';
hold on
xData = rand(30,1);
yData = rand(30,1);
zData = rand(30,1);
ft = fittype( 'poly44' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Robust = 'Bisquare';
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
h2 = plot( fitresult, [xData, yData], zData);
h2(1).FaceColor = 'r';

カテゴリ

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