sally_mn 发表于 2006-10-17 10:21

如何用matlab混编解方程(非线性)

我编写了如下的一个方程组

function =fch()

=solve('-(a+250)/b-(b-d)/(a-c)=0','(a+250)^2+b^2-125^2=0','-c/d-(b-d)/(a-c)=0','c^2+d^2-62500=0');

a=double(vpa(a))
b=double(vpa(b))
c=double(vpa(c))
d=double(vpa(d))

在matlab里运行没有问题,结果也对

运行
mcc -m fch

出现警告:
Warning: File: solve Line: 97 Column: 16
The MATLAB Compiler does not currently support MATLAB object-oriented programming.References to the method "findsym" will produce a run-time error.
Warning: File: solve Line: 87 Column: 19
The MATLAB Compiler does not currently support MATLAB object-oriented programming.References to the method "sym" will produce a run-time error.
Warning: File: vpa Line: 28 Column: 9
The MATLAB Compiler does not currently support MATLAB object-oriented programming.References to the method "sym" will produce a run-time error.
Warning: File: maple Line: 94 Column: 19
The MATLAB Compiler does not currently support MATLAB object-oriented programming.References to the method "sym" will produce a run-time error.

这是为什么,怎么处理?
请高人指点

eight 发表于 2006-10-17 10:26

原帖由 sally_mn 于 2006-10-17 10:21 发表
我编写了如下的一个方程组

function =fch()

=solve('-(a+250)/b-(b-d)/(a-c)=0','(a+250)^2+b^2-125^2=0','-c/d-(b-d)/(a-c)=0','c^2+d^2-62500=0');

a=double(vpa(a))
b=double(vpa(b))
c=double(vpa ...


mcc -m fch.m

我编译过,没有问题

sally_mn 发表于 2006-10-17 10:41

eight
你用的matlab版本多少?

sally_mn 发表于 2006-10-17 10:44

我用的是matlab6.5和c++builder5.0
你有可能是哪里出的问题
多谢你拉

eight 发表于 2006-10-17 10:53

原帖由 sally_mn 于 2006-10-17 10:44 发表
我用的是matlab6.5和c++builder5.0
你有可能是哪里出的问题
多谢你拉


我用 matlab r2006a 和 BCB 6.0,建议换个高版本的matlab试试

sally_mn 发表于 2006-10-17 10:56

matlab7.0 以上的版本是不是不支持c 数学函数库的调用法混编啊?

eight 发表于 2006-10-17 11:03

原帖由 sally_mn 于 2006-10-17 10:56 发表
matlab7.0 以上的版本是不是不支持c 数学函数库的调用法混编啊?


这个我不清楚,我没有经验,但觉得应该不会,除非集成到另外的模块中

sally_mn 发表于 2006-10-17 11:21

我看相关资料说,7.0以上版本将其封装了

我只是想通过二者的混编实现类似如上方程组的求解,并且脱离matlab环境

eight,你有什么好的方法、建议嘛

非常感谢你多次的帮助

sally_mn 发表于 2006-10-17 11:33

我在matlab7.0上
运行
mcc -m fch.m
出现错误
Warning:MATLAB Toolbox Path Cache is out of date and is not being used

eight 发表于 2006-10-17 12:25

原帖由 sally_mn 于 2006-10-17 11:33 发表
我在matlab7.0上
运行
mcc -m fch.m
出现错误
Warning:MATLAB Toolbox Path Cache is out of date and is not being used


刚才仔细看了一下mcc编译后的文件,虽然matlab命令窗口没有显示错误,但是在生成的文件中,有一个 mccExcludedFiles.log,里面主要的内容是:

This file contains the list of various toolbox functions that are not
included in the CTF file. An error will be thrown if any of these functions
are called at run-time. Some of these functions may be from toolboxes
that you are not using in your application. The reason for this is that
these toolboxes have overloaded some methods that are called by your code.
If you know which toolboxes are being used by your code, you can use the -p
flag with the -N flag to list these toolboxes explicitly. This will
cause MATLAB Compiler to only look for functions in the specified toolbox
directories in addition to the MATLAB directories. Refer to the MCC
documentation for more information on this.


也就是说,虽然编译成功,但是也有可能在运行的时候出错。我没有这方面的经验(包括mcc、求解方程组),所以也帮不上忙,呵呵

sally_mn 发表于 2006-10-18 09:28

还是要多谢你了eight
页: [1]
查看完整版本: 如何用matlab混编解方程(非线性)