声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 5033|回复: 8

[综合讨论] 如何将matlab里面描写的多项式,化简成通俗易懂的形式!

[复制链接]
发表于 2007-6-25 19:14 | 显示全部楼层 |阅读模式

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

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

x
有没有这样的软件可以将,matlab里面描写的多项式,化简成通俗易懂的形式!
例如:将"x/y"化成"x÷y"的形式.
回复
分享到:

使用道具 举报

发表于 2007-6-25 19:55 | 显示全部楼层
pretty(x),x是表达式
 楼主| 发表于 2007-6-25 20:16 | 显示全部楼层
这个函数我知道,我是想问有没有一种软件软件把matlab里面描述的多项式直接转化为公式编辑器写出来的形式,可以直接拿来写文章用!
发表于 2007-6-25 20:28 | 显示全部楼层
mathworks公司网站上有人写过这样一个程序
可以将符号表达式写成平时我们书写形式
function sexy(s)
%SEXY   Display a symbolic expression in human readable form.
% SEXY(S) displays the symbolic expression S in a small figure window,
% using standard mathematical notation.
%
% Examples:
%   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')

评分

1

查看全部评分

 楼主| 发表于 2007-6-26 08:05 | 显示全部楼层
原帖由 rocwoods 于 2007-6-25 20:28 发表
mathworks公司网站上有人写过这样一个程序
可以将符号表达式写成平时我们书写形式
function sexy(s)
%SEXY   Display a symbolic expression in human readable form.
% SEXY(S) displays the symbolic exp ...


不知道哪里出错了。
运行结果及截图如下:

>>  syms x t positive
f=taylor(cos(x));
sexy(f)
??? Index exceeds matrix dimensions.

Error in ==> d:\MATLAB6p5\work\sexy.m
On line 41  ==> W(3)=max(w(3)+10,125);


运行结果

运行结果
发表于 2007-6-26 14:06 | 显示全部楼层
syms x
f=taylor(cos(x));
sexy(f)
没错啊 !
 楼主| 发表于 2007-6-26 16:08 | 显示全部楼层
原帖由 rocwoods 于 2007-6-26 14:06 发表
syms x
f=taylor(cos(x));
sexy(f)
没错啊 !


下面是我运行结果的截图,不知道为什么?
jietu2.jpg
发表于 2007-6-26 16:21 | 显示全部楼层
矩阵下标超出范围了,你检查下每个变量。我以前用7.1的时候还有2006a(7.2)以及现在的2007a(7.4)都没问题。
 楼主| 发表于 2007-6-26 20:15 | 显示全部楼层
那可能是我版本的问题吧!我用的是6.5

是我的版本的问题,我在朋友电脑7.0版本运行了一遍,都OK,看来我要重装matlab啦!

[ 本帖最后由 unknowno 于 2007-6-26 20:34 编辑 ]
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-9-24 05:27 , Processed in 0.064916 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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