Clear Filters
Clear Filters

How to fill in o marker with color

8 views (last 30 days)
Briana Canet
Briana Canet on 11 Nov 2023
Answered: the cyclist on 11 Nov 2023
I am trying to fill in my 'o' markers. Please help.
clc;
clear;
close all;
% Curve Fit - Left of Target
x = [1500 1600 1750 1930 2250];
y = [0 0.25 0.5 0.75 1];
theFit=fit(x' , y', 'exp2','Lower',[0 0 -inf -inf],'Upper',[inf 0 0 0 ])
plot(theFit , x , y)
% Curve Fit - Right of Target
x = [2250 2435 2625 2810 3000];
y = [1 0.75 0.5 0.25 0];
theFit=fit(x' , y', 'A*x+b')
plot(theFit , x , y)
% Interior Square Footage
sqftL = [1500 1600 1750 1930 2250];
sqftR = [2250 2435 2625 2810 3000];
sqftUtilityL = [0 0.25 0.5 0.75 1];
sqftUtilityR = [1 0.75 0.5 0.25 0];
% Plot Utility Points
figure;
plot(sqftL,sqftUtilityL,'o',sqftR,sqftUtilityR,'o');
xlim([1500 3000]);ylim([0 1.25]);
yticks([sqftUtilityL 1.25]);
grid on;
xlabel('Interior Square Footage (ft^2)');
ylabel('Utility');
legend('Utility Left of Target Value','Utility Right of Target Value');
% Utility curve fittings
a = 1.279;
b = 0;
c = -26.3;
d = -0.00202;
curveX_left = linspace(1500,2250);
curveY_left = a*exp(b*curveX_left) + c*exp(d*curveX_left);
hold on;
plot(curveX_left,curveY_left,'Color','b');
p1 = -0.001333;
p2 = 3.999;
curveX_right = linspace(2250,3000);
curveY_right = p1*curveX_right + p2;
hold on;
plot(curveX_right,curveY_right,'Color','r');
legend('Utility Left of Target Value','Utility Right of Target Valye',...
'Left Curve Fitting','Right Curve Fitting');
% Consistency Checks
sqftLCheck = 2000;
sqftLUtilityCheck = 0.875;
sqftRCheck = 2340;
sqftRUtilityCheck = 0.875;
plot(sqftLCheck,sqftLUtilityCheck,'*','Color','c');
plot(sqftRCheck,sqftRUtilityCheck,'*','Color','m');
legend('Utility Left of Target Value','Utility Right of Target Value',...
'Left Curve Fitting','Right Curve Fitting','Left Consistency Check',...
'Right Consistency Check');

Answers (1)

the cyclist
the cyclist on 11 Nov 2023
Set the MarkerFaceColor property:
clc;
clear;
close all;
% Curve Fit - Left of Target
x = [1500 1600 1750 1930 2250];
y = [0 0.25 0.5 0.75 1];
theFit=fit(x' , y', 'exp2','Lower',[0 0 -inf -inf],'Upper',[inf 0 0 0 ])
theFit =
General model Exp2: theFit(x) = a*exp(b*x) + c*exp(d*x) Coefficients (with 95% confidence bounds): a = 1.279 (1.066, 1.492) b = 0 (fixed at bound) c = -26.63 (-48.85, -4.412) d = -0.002026 (-0.002675, -0.001378)
plot(theFit , x , y)
% Curve Fit - Right of Target
x = [2250 2435 2625 2810 3000];
y = [1 0.75 0.5 0.25 0];
theFit=fit(x' , y', 'A*x+b')
Warning: Start point not provided, choosing random start point.
theFit =
General model: theFit(x) = A*x+b Coefficients (with 95% confidence bounds): A = -0.001333 (-0.001345, -0.001322) b = 3.999 (3.969, 4.028)
plot(theFit , x , y)
% Interior Square Footage
sqftL = [1500 1600 1750 1930 2250];
sqftR = [2250 2435 2625 2810 3000];
sqftUtilityL = [0 0.25 0.5 0.75 1];
sqftUtilityR = [1 0.75 0.5 0.25 0];
% Plot Utility Points
figure;
h = plot(sqftL,sqftUtilityL,'o',sqftR,sqftUtilityR,'o');
set(h(1),'MarkerFaceColor','b')
set(h(2),'MarkerFaceColor','r')
xlim([1500 3000]);ylim([0 1.25]);
yticks([sqftUtilityL 1.25]);
grid on;
xlabel('Interior Square Footage (ft^2)');
ylabel('Utility');
legend('Utility Left of Target Value','Utility Right of Target Value');
% Utility curve fittings
a = 1.279;
b = 0;
c = -26.3;
d = -0.00202;
curveX_left = linspace(1500,2250);
curveY_left = a*exp(b*curveX_left) + c*exp(d*curveX_left);
hold on;
plot(curveX_left,curveY_left,'Color','b');
p1 = -0.001333;
p2 = 3.999;
curveX_right = linspace(2250,3000);
curveY_right = p1*curveX_right + p2;
hold on;
plot(curveX_right,curveY_right,'Color','r');
legend('Utility Left of Target Value','Utility Right of Target Valye',...
'Left Curve Fitting','Right Curve Fitting');
% Consistency Checks
sqftLCheck = 2000;
sqftLUtilityCheck = 0.875;
sqftRCheck = 2340;
sqftRUtilityCheck = 0.875;
plot(sqftLCheck,sqftLUtilityCheck,'*','Color','c');
plot(sqftRCheck,sqftRUtilityCheck,'*','Color','m');
legend('Utility Left of Target Value','Utility Right of Target Value',...
'Left Curve Fitting','Right Curve Fitting','Left Consistency Check',...
'Right Consistency Check');

Community Treasure Hunt

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

Start Hunting!