MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]利用fprintf输出vpa数值积分结果 (https://www.labfans.com/bbs/showthread.php?t=4145)

pizizhou 2008-08-17 15:40

[求助]利用fprintf输出vpa数值积分结果
 
源代码局部如下:

rou=sqrt((a*sin(t))^2+(b*cos(t))^2);
......
L2=vpa(int(rou,t,0,t1),12);
fprintf(fid1,' %12.5f',L2);

其中L2是进行椭圆弧长的积分计算,
程序提示:
??? Error using ==> fprintf
Function is not defined for 'sym' inputs.

请问,如何解决这个问题?

叉叉 2008-08-18 08:14

回复: [求助]matlab多项式的问题
 
LZ好像把fprintf的格式用错了。



应该是: fprintf(‘要输出的文字/格式’,变量名)

叉叉 2008-08-18 08:20

回复: [求助]matlab多项式的问题
 
啊!!不好意思才说错了,把printf搞混了,

COUNT=fprintf(fid,format,A)
A为你要打到txt里去的矩阵,format是将A格式化


我是个菜鸟,哎~~

pslpsl 2008-08-20 11:20

回复: [求助]利用fprintf输出vpa数值积分结果
 
[quote=pizizhou;14748]源代码局部如下:

rou=sqrt((a*sin(t))^2+(b*cos(t))^2);
......
L2=vpa(int(rou,t,0,t1),12);
fprintf(fid1,' %12.5f',L2);

其中L2是进行椭圆弧长的积分计算,
程序提示:
??? E...[/quote]



在[CODE]fprintf(fid1,' %12.5f',L2);[/CODE]前加上
[CODE]L2=eval(L2);[/CODE]应该就可以了


所有时间均为北京时间。现在的时间是 06:15

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.