y=2
theta=pi/10
r=0.5
axis equal
t = linspace(0+theta,2*pi+theta,6)
xr = x+r*cos(t)
yr = y+r*sin(t)
xk = zeros(1,11)
yk = zeros(1,11)
xk(1) = xr(1) yk(1) = yr(1) [xk(2) yk(2)] = CrossPoint([xr(1) yr(1)],[xr(3) yr(3)],[xr(2) yr(2)],[xr(5) yr(5)])
xk(3) = xr(2) yk(3) = yr(2) [xk(4) yk(4)] = CrossPoint([xr(2) yr(2)],[xr(4) yr(4)],[xr(1) yr(1)],[xr(3) yr(3)])
xk(5) = xr(3) yk(5) = yr(3) [xk(6) yk(6)] = CrossPoint([xr(2) yr(2)],[xr(4) yr(4)],[xr(3) yr(3)],[xr(5) yr(5)])
xk(7) = xr(4) yk(7) = yr(4) [xk(8) yk(8)] = CrossPoint([xr(3) yr(3)],[xr(5) yr(5)],[xr(1) yr(1)],[xr(4) yr(4)])
xk(9) = xr(5) yk(9) = yr(5) [xk(10) yk(10)] = CrossPoint([xr(1) yr(1)],[xr(4) yr(4)],[xr(2) yr(2)],[xr(5) yr(5)])
xk(11)=xk(1)yk(11)=yk(1)
plot(xk,yk)
%fill(xk,yk,'w')
axis equal
axis off
需要另写一个函数,计算交叉点
function [x,y]=CrossPoint(p1,p2,p3,p4)x1 = p1(1) y1 = p1(2)
x2 = p2(1) y2 = p2(2)
x3 = p3(1) y3 = p3(2)
x4 = p4(1) y4 = p4(2)
if x1==x2
x = x1
k2 = (y4-y3)/(x4-x3)
y = k2*(x-x3)+y3
elseif x3==x4
x = x3
k1 = (y2-y1)/(x2-x1)
y = k1*(x-x1)+y1
else
k1 = (y2-y1)/(x2-x1)
k2 = (y4-y3)/(x4-x3)
袜圆姿 sol = [-k1 1-k2 1]\[y1-k1*x1y3-k2*x3]
x = sol(1)y = sol(2)
end
end %圆球
syms x y z
F=x^2+y^2+z^2-16
nv=jacobian(F,[x y z])
[x,y,z]=sphere
surf(4*x,4*y,4*z)
shading interp
%指定某点
x=-1y=-2z=sqrt(16-x^2-y^2)
nv=double(subs(nv))
hold on
quiver3(x,y,z,nv(1),nv(2),nv(3),.5)%法向量
t=-1:.5:1
[xx,yy]=meshgrid(t+x,t+y)
zz=-(nv(1)*(xx-x)+nv(2)*(yy-y))/nv(3)+z
mesh(xx,yy,zz)%切平面告绝 clear all
close all
figurehold on
x1=[0 10 10 0 0]
y1=[0 0 0 0 0]
z1=[0 0 10 10 0]
x2=[10 10 10 10 10]
y2=[0 10 10 0 0]
z2=[0 0 10 10 0]
x3=[0 10 10 腔猛0 0]
y3=[10 10 10 10 10]
z3=[0 0 10 10 0]
x4=[0 0 0 0 0]
y4=[0 10 10 0 0]
z4=[0 0 10 10 0]
plot3(x1,y1,z1,'Color',[0 0 0])
plot3(x2,y2,z2,'Color',[0 0 0])
plot3(x3,y3,z3,'Color',[0 0 0])
plot3(x4,y4,z4,'Color',[0 0 0])
% plot3(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x5,y5,z5,'Color',[0 0 0])
view(3)
x=0:0.1:10
z=0.4.*(x-5).^2
y=zeros(length(x))
hold on
plot3(x,y,z)
y=10.*ones(length(x))
plot3(x,y,z)
y=0:0.1:10
z=0.4.*(y-5).^2
x=zeros(length(x))
plot3(x,y,z)
x=10.*ones(length(x))
plot3(x,y,z)
set(gca,'xtick',[],'xticklabel',[])
set(gca,'ytick',[],'yticklabel',[])
set(gca,'ztick',[],'zticklabel',[])
%设计低通滤波器:[N,Wc]=buttord()
%估算得到Butterworth低祥谨祥通滤波器的最小阶数N和3dB截止频率Wc
[a,b]=butter(N,Wc)%设计Butterworth低通滤波器
[h,f]=freqz()%求数字低通滤波器的频率响应
figure(2)% 打开窗口2
subplot(221)%图形谨搏显示分割窗口
plot(f,abs(h))%绘制Butterworth低通滤波器的幅频响应图
title(巴氏低通滤波器'')
grid%绘制带网格的图像
sf=filter(a,b,s)%叠加函数S经过低通滤波器以后的新函数
subplot(222)
plot(t,sf)%绘制叠加函数S经过低通滤波器以后的时域图形
xlabel('时间 (seconds)')
ylabel('时间按幅晌衡度')
SF=fft(sf,256)%对叠加函数S经过低通滤波器以后的新函数进行256点的基—2快速傅立叶变换
w= %新信号角频率
subplot(223)
plot())%绘制叠加函数S经过低通滤波器以后的频谱图
title('低通滤波后的频谱图')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)