声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2339|回复: 10

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

[复制链接]
发表于 2006-10-17 10:21 | 显示全部楼层 |阅读模式

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

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

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

function [a,b,c,d]=fch()

[a,b,c,d]=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.

这是为什么,怎么处理?
请高人指点
回复
分享到:

使用道具 举报

发表于 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

我编译过,没有问题
 楼主| 发表于 2006-10-17 10:41 | 显示全部楼层
eight
你用的matlab版本多少?
 楼主| 发表于 2006-10-17 10:44 | 显示全部楼层
我用的是matlab6.5和c++builder5.0
你有可能是哪里出的问题
多谢你拉
发表于 2006-10-17 10:53 | 显示全部楼层
原帖由 sally_mn 于 2006-10-17 10:44 发表
我用的是matlab6.5和c++builder5.0
你有可能是哪里出的问题
多谢你拉



我用 matlab r2006a 和 BCB 6.0,建议换个高版本的matlab试试
 楼主| 发表于 2006-10-17 10:56 | 显示全部楼层
matlab7.0 以上的版本是不是不支持c 数学函数库的调用法混编啊?
发表于 2006-10-17 11:03 | 显示全部楼层
原帖由 sally_mn 于 2006-10-17 10:56 发表
matlab7.0 以上的版本是不是不支持c 数学函数库的调用法混编啊?



这个我不清楚,我没有经验,但觉得应该不会,除非集成到另外的模块中
 楼主| 发表于 2006-10-17 11:21 | 显示全部楼层
我看相关资料说,7.0以上版本将其封装了

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

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

非常感谢你多次的帮助
 楼主| 发表于 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
发表于 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、求解方程组),所以也帮不上忙,呵呵
 楼主| 发表于 2006-10-18 09:28 | 显示全部楼层
还是要多谢你了eight
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-6-6 22:00 , Processed in 0.072994 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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