|
|
今天一位朋友运行M代码的时候,拷贝内容在Command Windows中运行的结果,跟把拷贝内容存储m文件单独运行的结果不一致,被MATLAB气的不行,找校长帮他报仇。
作为朋友,不能见死不救,于是私下把MATLAB打得半死,还拍下了它被打哭的样子,也算是给朋友报了一箭之仇了吧。
报仇代码:
- % 绘制哭泣表情
- figure('Color', 'white'); % 创建白色背景的图形窗口
- axis equal off; % 等比例坐标轴并隐藏轴线
- hold on;
- % 绘制脸部(黄色大圆)
- theta = linspace(0, 2*pi, 100);
- face_x = cos(theta);
- face_y = sin(theta);
- fill(face_x, face_y, [1 1 0.8], 'EdgeColor', 'k', 'LineWidth', 2); % 浅黄色填充,黑色边框
- % 绘制眼睛(黑色小圆)
- eye_radius = 0.15;
- eye_y = 0.3; % 眼睛的y坐标
- % 左眼
- left_eye_x = -0.4;
- fill(left_eye_x + eye_radius*cos(theta), eye_y + eye_radius*sin(theta), 'k');
- % 右眼
- right_eye_x = 0.4;
- fill(right_eye_x + eye_radius*cos(theta), eye_y + eye_radius*sin(theta), 'k');
- % 绘制嘴巴(向下弯曲的弧线)
- mouth_x = linspace(-0.4, 0.4, 50);
- mouth_y = -0.2 - 0.3 * (mouth_x.^2) / 0.4^2; % 二次曲线向下
- plot(mouth_x, mouth_y, 'r', 'LineWidth', 3);
- % 绘制眼泪
- % 左眼泪(水滴形状:小椭圆+小圆)
- teardrop_x = -0.4 + 0.05*cos(theta);
- teardrop_y = 0.15 + 0.1*sin(theta) - 0.15; % 在眼睛下方
- fill(teardrop_x, teardrop_y, 'c', 'EdgeColor', 'none'); % 青色眼泪
- % 右眼泪
- teardrop_x2 = 0.4 + 0.05*cos(theta);
- teardrop_y2 = 0.15 + 0.1*sin(theta) - 0.15;
- fill(teardrop_x2, teardrop_y2, 'c', 'EdgeColor', 'none');
- % 添加更多眼泪(可选)
- % 左眼泪下方再画一个小圆
- viscircles([-0.4, -0.05], 0.05, 'Color', 'c', 'LineWidth', 2);
- viscircles([0.4, -0.05], 0.05, 'Color', 'c', 'LineWidth', 2);
- hold off;
复制代码
将上述代码放到MATLAB里面运行,便可以复现MATLAB被打哭的样子,不信你试试。
|
|