加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

MatLab中将表达式转换成数学表达形式

(2011-03-09 08:44:56)
标签:

杂谈

分类: matlab

from: http://www.chinavib.com/forum/thread-47226-1-1.html

有没有这样的软件可以将,matlab里面描写的多项式,化简成通俗易懂的形式!

例如:将"x/y"化成"x÷y"的形式.

mathworks公司网站上有人写过这样一个程序
可以将符号表达式写成平时我们书写形式
function sexy(s)
%SEXY   Display  syms x t positive
  f=taylor(cos(x));
  sexy(f)
  f=int(exp(-t)*t^(x-1),t,0,inf);
  sexy(f)
%
% Required toolboxes: Symbolic Math
%
% See also ...\symbolic\pretty.

% Author: Naor Movshovitz
% email: lazy_n@yahoo.com
% May 2006

if ~isa(s,'sym')
    error('Argument must be of class ''sym''.')
end

S=['$',latex(s),'$'];
S=strrep(S,'&','& \quad');
S=strrep(S,'{\it','\mathrm{');
h=msgbox(S,'Sexy');
h1=get(h,'children');
h2=h1(1);
h3=get(h2,'children');
if isempty(h3)
    h2=h1(2); h3=get(h2,'children');
end
set(h3,'visible','off')
set(h3,'interpreter','latex')
set(h3,'string',S)
set(h3,'fontsize',12)
w=get(h3,'extent');
W=get(h,'position');
W(3)=max(w(3)+10,125);
W(4)=w(4)+40;
set(h,'position',W)
h4=h1(2);
if ~strcmp(get(h4,'tag'),'OKButton'), h4=h1(1); end
o=get(h4,'position');
o(1)=(W(3)-o(3))/2;
set(h4,'position',o)
set(h3,'visible','on')
example:
syms x
f=taylor(cos(x));
sexy(f)

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有