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;
相关推荐
之歆13 分钟前
HA 高可用集群指南
java·开发语言
lsx20240639 分钟前
电子商务网站主机:选择与维护指南
开发语言
wangluoqi1 小时前
c++ 逆元 小总结
开发语言·c++
BackCatK Chen1 小时前
第十五章 吃透C语言结构与数据形式:struct/union/typedef全解析
c语言·开发语言·数据结构·typedef·结构体·函数指针·联合体
瓦特what?1 小时前
插 入 排 序
开发语言·c++
m0_531237171 小时前
C语言-初始化赋值,函数,变量的作用域与生命周期
c语言·开发语言
张3蜂1 小时前
Python venv 详解:为什么要用、怎么用、怎么用好
开发语言·python
zyeyeye1 小时前
自定义类型:结构体
c语言·开发语言·数据结构·c++·算法
火龙果研究院2 小时前
在CentOS上安装Python 3.13需要从源码编译
开发语言·python·centos
invicinble2 小时前
关于学习技术栈的思考
java·开发语言·学习