| 查看: 2112 | 回复: 6 | |||
| 【悬赏金币】回答本帖问题,作者小虫飞更高将赠送您 5 个金币 | |||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | |||
[求助]
matlab光强编程,提示矩阵维度 必须一致,不知是哪里出现的问题,代码在下面 已有1人参与
|
|||
|
代码如下: clear all; k=10; f=1004.8; x=-1.5:0.01:1.5; y=-1.5:0.01:1.5; [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); Phi=atan(y1./x1); I=(i*k*exp(i*(pi/2+k*f)).*sin(2.*Phi).*quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)),2.23,pi)).^2; subplot(2,1,1); mesh(x1,y1,I); axis([-1.5 1.5 -1.5 1.5 0 1]); subplot(2,1,2); subimage(I*255); axis off; 出现错误如下: 矩阵维度必须一致。 出错 formula>@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)) 出错 quadl (line 62) y = feval(f,x,varargin{:}); y = y( .';出错 formula (line 9) I=(i*k*exp(i*(pi/2+k*f)).*sin(2.*Phi).*quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r.*sin(theta)),2.23,pi)).^2; |
» 猜你喜欢
职称评审没过,求安慰
已经有46人回复
回收溶剂求助
已经有7人回复
A期刊撤稿
已经有4人回复
垃圾破二本职称评审标准
已经有17人回复
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有22人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
求助文献
已经有3人回复
三无产品还有机会吗
已经有6人回复
送红花一朵 |
你好,我按照你的编程输入了下,还是有提示错误,请你在帮我解答下, clear all; k=10; f=1004.8; x=-0.5:0.01:0.5; y=-0.5:0.01;0.5 [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); [K,L]=size(r); for m=1:k for n=1:L Phi=atan(y1(n)./x1(m)); r0=r(m,n); eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)),2.23,pi); I0=(i*k*exp(i*(pi/2+k*f))*sin(2*Phi)*eq).^2; I(m,n)=I0; end end Re=real(I);Im=imag(I); s.FaceColor='flat'; %subplot(2,1,1); C=rand(K,L); mesh(x1,y1,real(I).C);hold on 提示错误如下: formula ans = 0.5000 未定义与 'double' 类型的输入参数相对应的函数 'Besselk'。 出错 formula>@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)) 出错 quadl (line 62) y = feval(f,x,varargin{:}); y = y( .';出错 formula (line 13) eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*Besselk(2,k.*r0.*sin(theta)),2.23,pi); >> |
3楼2020-09-11 11:15:13
hzlhm
至尊木虫 (著名写手)
- 应助: 387 (硕士)
- 金币: 18111.5
- 红花: 53
- 帖子: 2879
- 在线: 603.7小时
- 虫号: 1517335
- 注册: 2011-11-30
- 性别: GG
- 专业: 常微分方程与动力系统

2楼2020-09-08 19:50:51
|
刚我又调试了下,出现如下错误,您再帮我看下: k=10; f=1004.8; x=-0.5:0.01:0.5; y=-0.5:0.01:0.5; [x1,y1]=meshgrid(x,y); r=sqrt(x1.^2+y1.^2); [K,L]=size(r); for m=1:k for n=1:L Phi=atan(y1(n)./x1(m)); r0=r(m,n); eq=quadl(@(theta)(1+cos(theta))./(1-cos(theta)).*sin(theta).*besselk(2,k.*r0.*sin(theta)),2.23,pi); I0=(i*k*exp(i*(pi/2+k*f))*sin(2*Phi)*eq)^2; I(m,n)=I0; end end Re=real(I);Im=imag(I); s.FaceColor='flat'; %subplot(2,1,1); C=rand(K,L); mesh(x1,y1,real(I).C);hold on axis([-1.5 1.5 -1.5 1.5 0 1]); subplot(2,1,2); subimage(I*255); axis off 提示错误: 定义变量 "real" 或类 "real"。 出错 para (line 22) mesh(x1,y1,real(I).C);hold on |
4楼2020-09-11 15:30:28
hzlhm
至尊木虫 (著名写手)
- 应助: 387 (硕士)
- 金币: 18111.5
- 红花: 53
- 帖子: 2879
- 在线: 603.7小时
- 虫号: 1517335
- 注册: 2011-11-30
- 性别: GG
- 专业: 常微分方程与动力系统

5楼2020-09-11 22:54:25













.';
回复此楼