24小时热门版块排行榜    

查看: 989  |  回复: 4

zzucbx

新虫 (初入文坛)

[求助] MATLAB 程序优化

这里一个程序,算了两天了,还是没画出来图形,高手能不能优化一下,让我得到图形,万分感谢!
format long
warning off
f=zeros(9,9);
m=-4:1:4;
n=-4:1:4;
a=2.5;
b=2.5;
c=0.5;
d=20;
l=60;
e=(d/c)^2;
o=c/d;
for p=1:9;
for q=1:9;
f(p,q)=(-(a^3*b)/4-(a*b^3)/4+2*a*b*l^2-3*a^3*b*m(p)^2-3*a*b^3*n(q)^2)/(2*l^4);
end
end;
syms x y s k;
z=e*f(1,1)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(1,2)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(1,3)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(1,4)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(1,5)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(1,6)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(1,7)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(1,8)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(1,9)*(heaviside(x+4/4+o)-heaviside(x+4/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(2,1)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(2,2)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(2,3)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(2,4)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(2,5)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(2,6)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(2,7)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(2,8)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(2,9)*(heaviside(x+3/4+o)-heaviside(x+3/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(3,1)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(3,2)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(3,3)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(3,4)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(3,5)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(3,6)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(3,7)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(3,8)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(3,9)*(heaviside(x+2/4+o)-heaviside(x+2/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(4,1)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(4,2)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(4,3)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(4,4)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(4,5)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(4,6)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(4,7)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(4,8)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(4,9)*(heaviside(x+1/4+o)-heaviside(x+1/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(5,1)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(5,2)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(5,3)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(5,4)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(5,5)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(5,6)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(5,7)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(5,8)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(5,9)*(heaviside(x+0/4+o)-heaviside(x+0/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(6,1)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(6,2)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(6,3)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(6,4)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(6,5)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(6,6)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(6,7)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(6,8)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(6,9)*(heaviside(x-1/4+o)-heaviside(x-1/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(7,1)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(7,2)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(7,3)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(7,4)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(7,5)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(7,6)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(7,7)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(7,8)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(7,9)*(heaviside(x-2/4+o)-heaviside(x-2/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(8,1)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(8,2)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(8,3)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(8,4)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(8,5)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(8,6)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(8,7)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(8,8)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(8,9)*(heaviside(x-3/4+o)-heaviside(x-3/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o))+...
e*f(9,1)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y+4/4+o)-heaviside(y+4/4-o))+...
e*f(9,2)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y+3/4+o)-heaviside(y+3/4-o))+...
e*f(9,3)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y+2/4+o)-heaviside(y+2/4-o))+...
e*f(9,4)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y+1/4+o)-heaviside(y+1/4-o))+...
e*f(9,5)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y+0/4+o)-heaviside(y+0/4-o))+...
e*f(9,6)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y-1/4+o)-heaviside(y-1/4-o))+...
e*f(9,7)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y-2/4+o)-heaviside(y-2/4-o))+...
e*f(9,8)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y-3/4+o)-heaviside(y-3/4-o))+...
e*f(9,9)*(heaviside(x-4/4+o)-heaviside(x-4/4-o)).*(heaviside(y-4/4+o)-heaviside(y-4/4-o));
h=int(z^2*cos(1i*k*x),x,-sqrt(1-y^2)+s/2,sqrt(1-y^2)-s/2);
j=subs(h,y,-sqrt(1-(s/2)^2)/100:sqrt(1-(s/2)^2)/10000:sqrt(1-(s/2)^2)/100);
g=sum(j()*(sqrt(1-(s/2)^2)/100);%得出是g(s,0)
t=0:0.01:2;
g=subs(g,s,t)/0.867349799305449;
plot(t,g);
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jerkwin

专家顾问 (正式写手)

【答案】应助回帖

感谢参与,应助指数 +1
你这式子长的吓死人, 能算出来才是怪事.
2楼2013-09-25 22:19:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

babyoflion

金虫 (著名写手)

都是高手啊
3楼2013-09-25 23:01:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zzucbx

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by jerkwin at 2013-09-25 22:19:29
你这式子长的吓死人, 能算出来才是怪事.

原本只是一个卷积,但是在上面用conv算不出来,只能手写上去了。谢谢帮助
4楼2013-09-26 08:17:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jerkwin

专家顾问 (正式写手)

【答案】应助回帖

你不会用矩阵写, 至少也用循环写啊
总不能一个一个都写出来吧
5楼2013-09-26 08:58:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zzucbx 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[职场人生] 40+中年人失业后,还能找到好工作吗? +11 xqy2009 2026-10-13 13/650 2026-10-15 21:32 by bear2007
[有机交流] 用NBS溴化时溶剂除了CCl4外还有什么 +3 18834002860 2026-10-12 6/300 2026-10-15 14:30 by 长沙摩尔信息科�
[基金申请] 申请科研项目纯靠实力能成功吗? 200+7 David1982 2026-10-13 11/550 2026-10-15 10:30 by zyqchem
[硕博家园] 极限拉扯,如何抉择 +11 Isak0320 2026-10-12 15/750 2026-10-14 21:55 by 猫鱼不是鱼
[论文投稿] 二审4个多月了还是Awaiting Reviewer Scores 10+3 纳斯达克ML 2026-10-11 4/200 2026-10-14 17:30 by babero
[有机交流] OpenAI又攻克数学难题了,离AI做有机合成还有多远? +8 wangyl_123 2026-10-10 13/650 2026-10-14 15:12 by zuesli
[教师之家] 课题组会帮你通过考核么? +4 好运来~9527 2026-10-10 7/350 2026-10-13 08:41 by xli1984
[公派出国] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 9/450 2026-10-11 22:34 by XQNyDCa1Tk5n
[找工作] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 22:26 by XQNyDCa1Tk5n
[公派出国] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 22:26 by XQNyDCa1Tk5n
[考博] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 9/450 2026-10-11 22:15 by XQNyDCa1Tk5n
[考博] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 22:11 by XQNyDCa1Tk5n
[教师之家] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 (EPI+-1)(金币-50) +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 22:06 by XQNyDCa1Tk5n
[教师之家] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 (EPI+-1)(金币-50) +5 qR2AdCWTVtkw 2026-10-09 10/500 2026-10-11 14:25 by VOMexwnDzOFZ
[考研] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 13:51 by VOMexwnDzOFZ
[硕博家园] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +5 qR2AdCWTVtkw 2026-10-09 8/400 2026-10-11 13:45 by VOMexwnDzOFZ
[找工作] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 10:54 by VOMexwnDzOFZ
[找工作] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +4 qR2AdCWTVtkw 2026-10-09 7/350 2026-10-11 10:34 by VOMexwnDzOFZ
[考博] 招收博士生一名 +3 mandolin 2026-10-10 3/150 2026-10-11 10:21 by 不是山谷!
[公派出国] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +4 qR2AdCWTVtkw 2026-10-09 4/200 2026-10-11 03:14 by M0zrYVSAnxpE
信息提示
请填处理意见