怎么作出三维视图啊?
占空比直流分量基波2次谐波3次谐波 12345670-100000000.05-0.90.1991790.1967260.192680.1870980.1800630.1716790.1620660.1-0.80.3934530.3741960.3433570.3027310.2546480.201820.1471530.15-0.70.5780390.5150360.4191880.3027310.1800630.0655750.0284540.2-0.60.7483910.6054610.4036410.1870983.12E-170.1247320.1729890.25-0.50.9003160.636620.3001053.9E-170.1800630.2122070.1286170.3-0.41.0300720.6054610.1311510.1870980.2546480.1247320.0562080.35-0.31.1344650.5150360.0663930.3027310.1800630.0655750.1796520.4-0.21.2109230.3741960.2494640.3027312.89E-160.201820.1069130.45-0.11.2575640.1967260.3781550.1870980.1800630.1716790.0825770.501.273243.61E-160.4244133.61E-160.2546484.55E-160.181891想把上面的表格做成三维视图,想要直观地看出占空比与频谱分量之间的关系,公式为z=sin(x*n*pi).*4./(n*pi),直流分量z0=2*x-1;x为占空比,n是谐波次数。怎么作出三维视图啊?请帮帮忙,谢谢! help mesh help surf or plot3d
回复 板凳 VibrationMaster 的帖子
x=0:0.05:1n=1:21;
b_n=4./(n*pi);
y=sin(x.*n*pi);
Y=y.*b_n;
z=abs(Y)
meshgrid(x,n)
plot3(x,n,z)
上面这个小程序运行的时候只画出一条曲线,是怎么回事啊?求救!
回复 沙发 ChaChing 的帖子
x=0:0.05:1n=1:21;
b_n=4./(n*pi);
y=sin(x.*n*pi);
Y=y.*b_n;
z=abs(Y)
meshgrid(x,n)
mesh(x,n,z)
上面这个程序运行的时候出现错误:mesh(x,n,z)
Warning: Z must not be a scalar or vector, not rendering surface.
搞不清楚这个维数怎么定义啊?请帮帮忙!谢谢! z中数据只有一维,先确保它为两维
回复 地板 yuanping09 的帖子
plot3是画三维曲线的命令 LZ解决否? 参考下, 做个结束clc; clear
x=(0:0.05:1)'; n=1:21;
b_n=4./(n*pi); y=sin(x*n*pi);
Y=y.*repmat(b_n,length(x),1); z=abs(Y);
z0=2*x-1; zz=;
pcolor(,x,zz); shading interp
页:
[1]