声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 902|回复: 4

[编程技巧] Inner matrix dimensions must agree 出错求助

[复制链接]
发表于 2007-12-29 11:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function yout=plot111
a=zeros(21,1);
n=0;
for i=1:21
    a(i)=(1/(pi*500000000000)).*exp(-40000.*n.^2).*dblquad(@fun,0,25,0,2*pi,[],[],n);
    i
    n=n+1;
end
n=1:20;
plot(n,a);
function z=fun(x,y,n)
    z=x.*(x.*cos(y)+20000.*n.^2).^2*(x.*sin(y)+20000.*n.^2).^2.*exp(-x.^2./(20000.*n.^2)-2.*x.*cos(y)-2.*x.*sin(y));


??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> plot111>fun at 12
    z=x.*(x.*cos(y)+20000.*n.^2).^2*(x.*sin(y)+20000.*n.^2).^2.*exp(-x.^2./(20000.*n.^2)-2.*x.*cos(y)-2.*x.*sin(y));
Error in ==> quad at 62
y = f(x, varargin{:});
Error in ==> dblquad>innerintegral at 88
    Q(i) = feval(quadf, intfcn, xmin, xmax, tol, trace, y(i), varargin{:});
Error in ==> quad at 62
y = f(x, varargin{:});
Error in ==> dblquad at 64
Q = feval(quadf, @innerintegral, ymin, ymax, tol, trace, intfcn, ...
Error in ==> plot111 at 5
    a(i)=(1/(pi*500000000000)).*exp(-40000.*n.^2).*dblquad(@fun,0,25,0,2*pi,[],[],n);
>>

[ 本帖最后由 eight 于 2007-12-29 14:39 编辑 ]
回复
分享到:

使用道具 举报

 楼主| 发表于 2007-12-29 11:58 | 显示全部楼层
我修改了一下
function yout=plot111
a=zeros(21,1);
n=0;
for i=1:21
    a(i)=(1/(pi*500000000000)).*exp(-40000*n.^2).*dblquad(@fun,0,25,0,2*pi,[],[],n);
    i
    n=n+1;
end
n=1:20;
plot(n,a);
function z=fun(x,y,n)
    z=x.*(x.*cos(y)+20000*n.^2).^2.*(x.*sin(y)+20000*n.^2).^2.*exp(-x.^2./(20000*n.^2)-2*x.*cos(y)-2*x.*sin(y));
怎么像以个死循环啊
大家帮我看看
发表于 2007-12-29 12:05 | 显示全部楼层

回复 #3 abcdefg 的帖子

你的程序我复制后没法运行
发表于 2007-12-29 14:38 | 显示全部楼层
攒取积分,然后到置顶帖中找答案
 楼主| 发表于 2007-12-29 15:59 | 显示全部楼层
是啊,我的也是老出现好多warning,你帮我看看哪里出错了啊,谢谢我实在查不出来
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-17 14:01 , Processed in 0.052365 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表