| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 7717 人关注过本帖
标题:◆◆Matlab常见问题◆◆[转](2.1)软件及编程问题
只看楼主 加入收藏
abingchem
Rank: 6Rank: 6
等 级:贵宾
威 望:24
帖 子:716
专家分:0
注 册:2004-12-30
收藏
 问题点数:0 回复次数:11 
◆◆Matlab常见问题◆◆[转](2.1)软件及编程问题

更多请见:http://bbs.dartmouth.edu/~fangq/MATH/FAQ/


>************************************************************************<
> 第二节:Matlab的常见问题
>************************************************************************<

=================================== - [返回]
1).Matlab 6.X在Windows 2000/XP上无法启动
:#highsun,2001/3/2, SMTH/NewSoftware #

MathWorks的解决办法虽然是针对繁体中文系统的,我试过在简体
中文系统下一样可以用。

http://www.mathworks.com/support/solutions/data/26985.shtml
http://www.mathworks.com/support/solutions/data/26990.shtml

Solution Number: 26990
Date Last Modified: 2001-01-30
Product: MATLAB 6.0 ==> Current Version
Platform: Windows

Problem Description

Why do I encounter problems when running MATLAB 6.0 (R12) on Hebrew
or
Traditional Chinese (Taiwan) Windows? I try to start MATLAB but after
the splash screen disappears, MATLAB exits.
PLEASE NOTE: This solution only applies to MATLAB 6.0. If you have a
similar problem with MATLAB 5.0 or the Student Edition of MATLAB 5.0,
see solution 7213.

Solution:

This problem is caused by a bug in one of the font properties files
we ship with MATLAB. The font.properties file is used by Java to map
the standard Java font names to system fonts for a particular
However, we made a few assumptions that do not hold for the Hebrew or
language operating system. Traditional Chinese Windows, causing
We have created a fixed version of the mwt.jar file that you can use
this problem. correct this. To use the fix, first rename your mwt.jar
to file as mwt.old. This file is found in the $MATLAB\java\jar
directory, where $MATLAB is your MATLAB root directory. Then
download the newer mwt.jar file from:

ftp://ftp.mathworks.com/pub/tech-support/solutions/s26990

and place it in your $MATLAB\java\jar directrory. Then restart
MATLAB;this should correct the problem you're seeing.

=================================== - [返回]
2).我有一组x,y,z值,非规则排列,如何在Matlab中绘图?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/12, BigGreen/MathTools #

参见第一节问题7)

=================================== - [返回]
3).如何在给定句柄的axis里绘图?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/12, SMTH/MathTools #

plot(data,'parent',haxis);
或者
hbar=bar(data);
set(hbar,'parent',haxis);


=================================== - [返回]
4).由Matlab符号运算得到的公式怎么才能将数据代进去运算?
:#ramjet (德芙)2002/3/3, SMTH/MathTools #

使用subs(),或先将值赋予一个符号变量,然后用eval()


=================================== - [返回]
5).在Matlab中如何求最值点?如何求一维数组的极值?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/18, SMTH/MathTools#

最值:
一维或多维数组最值用max(data(:))
如果想返回最值所在的位置,用[Y,I]=max(data)

:#FangQ(Qianqian.Fang@dartmouth.edu), 2001/4/21,UESTC/Math#

极值:
data是你的数据,
find(diff(sign(diff(data)))==-2)+1
找到极大值的位置

find(diff(sign(diff(data)))==2)+1
找到极小值的位置

data(find(diff(sign(diff(data)))==-2)+1)和
data(find(diff(sign(diff(data)))==2)+1)
返回的是极大值和极小值


=================================== - [返回]
6).Matlab中如何作线性拟合/线性回归/多元线性回归?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21, BigGreen/MathTools #


即用y=a*x+b来拟合一组数据{{x1,y1},{x2,y2}…{xn,yn}}
matlab中使用polyfit
x=data(:,1);
y=data(:,2);
p=polyfit(x,y,1);
p(1)为斜率a,p(2)为截距b

多元线性回归即用y=a1*x1+a2*x2+..+am*xm来拟合数据点{x1i,x2i,…xmi,yi}
(i=1~n)

|x11,x21,…xm1|
A=|x12,x22,…xm2|
|…………… |
|x1n,x2n,…xmn|

Y={y1,y2,y3,…,yn}'

则系数{a1,a2,…,am}'=pinv(A)*Y
在matlab中使用
coeff=A\Y
则可以得到最小二乘意义上的拟合系数


=================================== - [返回]
7).Matlab中如何作圆回归?
:#Peter Boettcher (boettcher@ll.mit.edu),2002/5/16, comp.soft-sys.matlab#

Q5.5: How can I fit a circle to a set of XY data?
=================================================

An elegant chunk of code to perform least-squares circle fitting
was written by Bucher Izhak and has been floating around the
newgroup for some time. The first reference to it that I can
find is in:

function [xc,yc,R,a] = circfit(x,y)
%CIRCFIT Fits a circle in x,y plane
%
% [XC, YC, R, A] = CIRCFIT(X,Y)
% Result is center point (yc,xc) and radius R.A is an
% optional output describing the circle's equation:
%
% x^2+y^2+a(1)*x+a(2)*y+a(3)=0

% by Bucher izhak 25/oct/1991

n=length(x); xx=x.*x; yy=y.*y; xy=x.*y;
A=[sum(x) sum(y) n;sum(xy) sum(yy)...
sum(y);sum(xx) sum(xy) sum(x)];
B=[-sum(xx+yy) ; -sum(xx.*y+yy.*y) ; -sum(xx.*x+xy.*y)];
a=A\B;
xc = -.5*a(1);
yc = -.5*a(2);
R = sqrt((a(1)^2+a(2)^2)/4-a(3));

Tom Davis provided a more sophisticated approach that works
for more cases in and Code included.


=================================== - [返回]
8).Matlab中如何绘制箭头?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21, SMTH/MathTools #

http://www.mathworks.com/matlabcentral/fileexchange/index.jsp
2-D Plotting and Graphics中查找arrow.m,或者
http://www.mathworks.com/matlabcentral/spotlight/arrows.shtml
http://www.math.umd.edu/~jec/matcomp/matcompmfiles/mfiles.html


=================================== - [返回]
9).Matlab中如何作二维数据的插值?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21, BigGreen/MathTools #


对于一维、二维、三维规则数据点阵使用interp1/interp2/interp3,
二维、三维非规则数据用griddata/griddata3


=================================== - [返回]
10).Matlab中如何绘制三维数据阵?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21, BigGreen/MathTools #


如果使用matlab,打开帮助窗口,在目录树上找到
MATLAB\Using Matlab\
3-D Visualization: Volume Visualization Techniques

如果图形复杂,建议使用Tecplot,参见Tecplot手册中数据格式,将你
的三维数据读入Tecplot,双击zone,可以设置mesh/contour/surface
transparency等。

在Field菜单中有3D Iso-surface Details和3D Slice Details,可以绘制等值
面和任意平面的截面图。


=================================== - [返回]
11).Matlab中如何注解一大段代码?
:#hyphone,2002/7/6, SMTH/MathTools #

注释大段代码选中代码,Ctrl+R;取消注释,选中代码,Ctrl+T。
或者用Edit菜单或者右键弹出中的注释。

:#misc,2002/6/21, SMTH/MathTools #

if(0)
大段的代码
end


=================================== - [返回]
12).Matlab中如何计算程序运行的时间?
:#misc,2002/6/21, SMTH/MathTools #

tic
your_code;
toc
或者使用
t=cputime;
your_operation;
cputime-t


=================================== - [返回]
13).Matlab中如何改变默认的工作路径?
:#SindyGong, 2002/4/7, SMTH/MathTools #

编辑一个startup.m文件,其中cd yourpath
或者在X:\matlab\toolbox\local\matlabrc.m的最后添加cd yourpath
参见:
http://www.mathworks.com/support/solutions/data/25164.shtml


=================================== - [返回]
14).Matlab如何改变默认的图形字体?
:#comp.soft-sys.matlab FAQ#

编辑一个startup.m文件,其中
set(0,'DefaultObjectnamePropertyName',Value)
或者在X:\matlab\toolbox\local\matlabrc.m的最后添加
set(0,'DefaultObjectnamePropertyName',Value)


=================================== - [返回]
15).如何在Matlab中实现交互操作?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #


如果只在命令窗口进行交互操作,请参见demo中的例子,主要是
通过input命令和pause/clear/disp等实现的,还有一些窗口资源可以使
用:
uigetfile,uiputfile,uiwait,uisetcolor,uisetfont, uiopen,uisave
inputdlg,msgbox,helpdlg,questdlg,warndlg,errordlg


=================================== - [返回]
16).Matlab中为什么只能在小数点后显示四位?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #


用format命令来改变命令窗口数字的显示格式和精度,但不会影
响matlab的计算精度,matlab的矩阵运算默认都是双精度浮点型运算。

=================================== - [返回]
17).Matlab如何在命令窗口按照格式输出?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,SMTHTools #

fprintf(1,"your_format_string",var1,var2,…);


=================================== - [返回]
18).如何在Matlab中画隐函数曲线?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #


http://www.mathworks.com/matlabcentral/fileexchange/index.jsp
查找implicit,会找到一个Arthur Jutan写的implot.m
Mathematica中绘制隐函数用ImplicitPlot[]
或者ImplicitPlot3D[]
Maple中为implicitplot(),implicitplot3d()
参见
http://engineering.dartmouth.edu/~fangq/MATH/download/source/
ImplicitPlot3D.htm


=================================== - [返回]
19).Matlab中什么函数可以删除矩阵的某一行或列?
:#FangQ(Qianqian.Fang@dartmouth.edu),2002/6/21,BigGreen/MathTools #


A(j,:)=[]; %删除A的第j行
A(:,i)=[]; %删除A的第i列


搜索更多相关主题的帖子: Matlab 软件 
2007-03-29 21:21
yjpgmwvtkd
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-7-4
收藏
得分:0 
楼主的帖真厉害,已经感觉到讲的很精髓了,
非常支持,也希望你能教教我。

2007-07-04 09:52
wg_2001
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-18
收藏
得分:0 

没想到这么专业,太好了
以后会有很大提高了
2007-09-18 11:03
xutaoandsushi
Rank: 1
来 自:成都
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-16
收藏
得分:0 
怎么调试一个程序
我怎[bo][/bo]一[font=宋体][/font]
2008-11-16 22:47
nielixian
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-17
收藏
得分:0 
新手
新手 学习了 非常3q
2008-11-17 10:25
czjszx2000
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-12-10
收藏
得分:0 
非常好 ,谢谢楼主
2008-12-10 10:13
tuziztt
Rank: 1
等 级:新手上路
威 望:1
帖 子:8
专家分:0
注 册:2009-9-17
收藏
得分:0 
我要加油学!↖(^ω^)↗
2009-09-17 21:11
d20062303732
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-10-11
收藏
得分:0 
菜鸟来报道,原来我是菜鸟啊

终生学习,学习终生
2009-10-11 23:00
xiannantian
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-4-25
收藏
得分:0 
请问怎么用matlab解超越方程?
2010-04-25 19:03
mustcome
Rank: 2
等 级:论坛游民
帖 子:25
专家分:10
注 册:2007-11-10
收藏
得分:0 
看过了!!没什么印象!
2010-08-22 08:32
快速回复:◆◆Matlab常见问题◆◆[转](2.1)软件及编程问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018711 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved