声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1378|回复: 12

[综合讨论] 求教高手,为什么老出错!非常感谢!

[复制链接]
发表于 2009-1-6 21:41 | 显示全部楼层 |阅读模式

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

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

x
对三角函数的积分,为什么老出错!
程序如下:
clear
syms x p p1 p2;
p1=sin(0.04588*x)-sinh(0.04588*x)+((sin(1.875)+sinh(1.875))/(cos(1.875)+cosh(1.875)))*(cosh(0.04588*x)-cos(0.04588*x));
p2=sin(0.12146*x)-sinh(0.12146*x)+((sin(4.964)+sinh(4.964))/(cos(4.964)+cosh(4.964)))*(cosh(0.12146*x)-cos(0.12146*x));
p=double(156.02*int(p1*p1+p2*p1,'x',0,40.868));
错误提示:
??? Error using ==> reshape
To RESHAPE the number of elements must not change.
Error in ==> sym.maple at 94
      result = reshape(result,size(varargin{3}));
Error in ==> sym.int at 51
   r = reshape(maple('map','int',f(:),[x.s '=(' a.s ')..(' b.s ')']),size(f));
Error in ==> ouhefangchengjisuan at 5
p=double(156.02*int(p1*p1+p2*p1,'x',0,40.868));


还请大侠帮忙解答一下,非常感谢,亟盼!!
回复
分享到:

使用道具 举报

发表于 2009-1-6 23:48 | 显示全部楼层

回复 楼主 liaoliaoer 的帖子

为何运行代码之后Matlab显示Busy?
 楼主| 发表于 2009-1-7 10:13 | 显示全部楼层

多等一会,就会出现我说的那个错误,不知道为什么,自己水平比较菜,没明白错误的意思,还请大虾们明示,不胜感激呀!!
发表于 2009-1-7 10:58 | 显示全部楼层

请大家帮我看看这个程序如何修改

function pushbutton1_Callback(hObject, eventdata, handles)
%绘制高程曲线
global str
axes(handles.axes1)
width=1200:400:4000;%x
depth=1200:400:3600;%y
height=str;
wi=1200:50:4000;
di=1200:50:3600;
di=di';
zcubic=interp2(width,depth,height,wi,di,'cubic');
%在二维上标注等高线
[C,H]=contour(wi,di,zcubic);
clabel(C,H)
xlabel('Width')
ylabel('Depth')
title('在二维上标注等高线')
function pushbutton5_Callback(hObject, eventdata, handles)
%选择图片路径
global str
[filename,pathname]=uigetfile(['*.txt';],'读取数据');
str=imread(str);
handles.data=data;
 楼主| 发表于 2009-1-7 11:12 | 显示全部楼层
原帖由 huxuemin2008 于 2009-1-7 10:58 发表
function pushbutton1_Callback(hObject, eventdata, handles)
%绘制高程曲线
global str
axes(handles.axes1)
width=1200:400:4000;%x
depth=1200:400:3600;%y
height=str;
wi=1200:50:4000;
di=1200:50:3 ...




我说这位兄才,你要是能解决完我的问题再提问也说得过去:@L
 楼主| 发表于 2009-1-7 15:57 | 显示全部楼层
我试算了一下,6.5版本的就是一直是busy,7.0版本以上就是等一两分钟就出现上面的错误,不知为什么,简单的式子也能算的。
发表于 2009-1-7 19:47 | 显示全部楼层

回复 6楼 liaoliaoer 的帖子

Matlab R2008a运行了5分钟,没有反应!
double的用法好像不是这样吧
 楼主| 发表于 2009-1-7 19:53 | 显示全部楼层
原帖由 ch_j1985 于 2009-1-7 19:47 发表
Matlab R2008a运行了5分钟,没有反应!
double的用法好像不是这样吧

非常感谢你的关注与帮助!
我是7.0的,可以运行,也可以把double去掉,我这还是出现这个问题!
 楼主| 发表于 2009-1-8 12:36 | 显示全部楼层
撇开我提的问题,如果要对156.02*p计算式在(0,40.868)上积分,该如何进行?
p1=sin(0.04588*x)-sinh(0.04588*x)+((sin(1.875)+sinh(1.875))/(cos(1.875)+cosh(1.875)))*(cosh(0.04588*x)-cos(0.04588*x));
p2=sin(0.12146*x)-sinh(0.12146*x)+((sin(4.964)+sinh(4.964))/(cos(4.964)+cosh(4.964)))*(cosh(0.12146*x)-cos(0.12146*x));
p=p1*p1+p2*p1

谢谢关注与解决,感谢呀………………祝你牛年发大财呀…………
 楼主| 发表于 2009-1-8 12:39 | 显示全部楼层
哇塞,我在2008上算出来了,难道是版本的问题,暗自窃喜………………:lol
谢谢唠嗑主任(这个名字好像不适合当领导,有点不务正业:lol )关注我的问题!

评分

1

查看全部评分

发表于 2009-1-8 23:32 | 显示全部楼层

回复 10楼 liaoliaoer 的帖子

代码还是原来的吗?不是的话,贴出来和大家分享一下
 楼主| 发表于 2009-1-18 09:07 | 显示全部楼层
对,还是原来的。
发表于 2009-1-18 09:28 | 显示全部楼层

回复 楼主 liaoliaoer 的帖子

对源程序做了一些处理,变sinh/cosh为指数形式,发现运行速度快了很多,和想的一样,呵呵。没有出现问题,我用的是2008a版本
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
syms x
a1=(sin(1.875)+sinh(1.875))/(cos(1.875)+cosh(1.875));
a2=(sin(4.964)+sinh(4.964))/(cos(4.964)+cosh(4.964));
p1=sin(0.04588*x)-a1*cos(0.04588*x)+0.5*(a1-1)*exp(0.04588*x)+0.5*(a1+1)*exp(-0.04588*x);
p2=sin(0.12146*x)-a2*cos(0.12146*x)+0.5*(a2-1)*exp(0.12146*x)+0.5*(a2+1)*exp(-0.12146*x);
p=double(156.02*int(p1*p1+p2*p1,'x',0,40.868));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> p

p =

  9.9599e+003
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-9-22 21:28 , Processed in 0.064515 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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