Matlab 版 (精华区)
发信人: zjliu (Robusting), 信区: Matlab
标 题: 数学工具FAQ[smth]--第二节:Matlab常见问题1
发信站: 哈工大紫丁香 (Tue Dec 17 14:59:00 2002) , 转信
>************************************************************************<
> 第二节: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.
--
※ 来源:.哈工大紫丁香 http://bbs.hit.edu.cn [FROM: 202.118.229.86]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.433毫秒