To plot a smiley face in MATLAB, you can use the scatter plot function and plot a sequence of dots with appropriate colors and sizes. Here's an example:
main.m
% Define the coordinates and colors for the dotsx = [00.20.40.60.81];
y = [0.50.70.80.80.70.5];
c = [10.80.2; 10.80.2; 10.80.2; 10.80.2; 10.80.2; 0.50.51];
s = [3003003003003001000];
% Plot the dotsscatter(x, y, s, c, 'filled');
hold on
% Add the eyeseye_x = [0.30.7];
eye_y = 0.7;
eye_c = [0.20.20.2];
eye_s = 150;
scatter(eye_x, eye_y, eye_s, eye_c, 'filled');
% Add the mouththeta = 0:pi/20:pi;
mouth_x = 0.5 + 0.2*cos(theta);
mouth_y = 0.2*sin(theta) + 0.4;
mouth_c = [0.80.20.2];
mouth_s = 100;
scatter(mouth_x, mouth_y, mouth_s, mouth_c, 'filled');
% Set the axis and figure propertiesaxis equal
axis off
set(gcf, 'color', [0.80.81])
683 chars
30 lines
This code produces the following smiley face plot: