change color when i plot more surface fit
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Kevin Holly
el 18 de Oct. de 2022
Editada: Kevin Holly
el 18 de Oct. de 2022
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';
0 comentarios
Ver también
Categorías
Más información sobre Fit Postprocessing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!