MATLAB绘制克莱因瓶

MATLAB绘制克莱因瓶

Matlab 复制代码
clc;close all;clear all;warning off;% clear all
rand('seed', 100);
randn('seed', 100);
format long g;


% Parameters
u_range = linspace(0, 2*pi, 100);
v_range = linspace(0, pi, 50);
[U, V] = meshgrid(u_range, v_range);

% Parametric equations for the Klein bottle
x = (3 + cos(U/2).*cos(V) - 0.5*cos(U).*cos(2*V) - sin(U/2).*sin(2*V)).*cos(U);
y = (3 + cos(U/2).*cos(V) - 0.5*cos(U).*cos(2*V) - sin(U/2).*sin(2*V)).*sin(U);
z = 4*sin(U/2).*cos(V);

% Plot the Klein bottle
figure;
surf(x, y, z, 'FaceColor', 'blue', 'EdgeColor', 'none');
hold on;
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Klein Bottle');
grid on;
axis equal;
view(3); % Set the viewing angle
camlight; % Add lighting
lighting phong; % Use phong lighting
hold off;
相关推荐
OxYGC2 小时前
[玩转GoLang] 5分钟整合Gin / Gorm框架入门
开发语言·golang·gin
锐策2 小时前
Lua 核心知识点详解
开发语言·lua
kyle~3 小时前
C/C++---动态内存管理(new delete)
c语言·开发语言·c++
落日沉溺于海3 小时前
React From表单使用Formik和yup进行校验
开发语言·前端·javascript
鲸屿1954 小时前
python之socket网络编程
开发语言·网络·python
没有梦想的咸鱼185-1037-16634 小时前
基于R语言机器学习方法在生态经济学领域中的实践技术应用
开发语言·机器学习·数据分析·r语言
向上的车轮5 小时前
基于go语言的云原生TodoList Demo 项目,验证云原生核心特性
开发语言·云原生·golang
The Chosen One9855 小时前
C++ : AVL树-详解
开发语言·c++
PH_modest5 小时前
【Qt跬步积累】—— 初识Qt
开发语言·qt
怀旧,5 小时前
【C++】18. 红⿊树实现
开发语言·c++