![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Matlab
爱吃的小花猫
来者皆客
展开
-
Fzreo matlab
fzeroRoot of nonlinear functioncollapse all in pageSyntaxx = fzero(fun,x0) examplex = fzero(fun,x0,options) examplex = fzero(problem) example[x,fval,exi转载 2015-04-15 08:57:54 · 1149 阅读 · 0 评论 -
MATLAB indexing question
Question:I have a matrix, for exampleA = [ 1 2 3; 4 5 6; 7 8 9] ;and a vector of size 1x3 which specifies which element in each row is the one I'm looking for - i.e. Ifvector = [ 1 2 1 ]原创 2015-03-31 03:53:45 · 1327 阅读 · 0 评论 -
编程学习网站 收集于网络
1、http://snippets.dzone.com/tag/c/ --数以千计的有用的C语言源代码片段2、http://www.hotscripts.com/category/c-cpp/scripts-programs/ Hotscripts --提供数以百计的C和C++脚本和程序。所有程序都分为不同的类别。3、http://www.planetsourcecode.com/vb/d原创 2015-03-08 17:06:05 · 63299 阅读 · 0 评论 -
matlab Newton method
% Matlab script to illustrate Newton's method% to solve a nonlinear equation% this particular script finds the square root of a number M% (input by the user)% note that the function we are tryin原创 2015-03-13 05:13:34 · 1123 阅读 · 0 评论 -
MATLAB中eig的作用
MATLAB中eig的作用eig Find eigenvalues and eigenvectors 返回矩阵的特征值和特征向量; [V,D] = eig(A) D是特征值 V特征向量 例如a=[1 2 3;4 5 6;7 8 9];[V,D]=eig(a) 结果: V = -0.2320 -0.7858 0.4082 -0.5253 -0.原创 2015-03-29 16:18:06 · 7397 阅读 · 0 评论 -
Paired t-test
1 Continuous Dependent Variable with normal distribution1 (2 Level) Categorical Independent Variable Task Completion timeSubjectInterface 1Interface 2转载 2015-03-29 03:59:17 · 5617 阅读 · 0 评论 -
matlab secant method
% Matlab script to illustrate the secant method% to solve a nonlinear equation% this particular script finds the square root of a number M% (input by the user)% note that the function原创 2015-03-13 05:09:22 · 1793 阅读 · 0 评论 -
Matlab 输入特殊字符
下标用 _(下划线) 希腊字母等特殊字符用 \加拼音 如 α \alpha β \beta γ \gamma θ \theta Θ \Theta Г \Gamma δ \delta Δ \Delta ξ \xi Ξ \Xi η \elta ε \epsilong ζ \zeta μ \miu υ \nu τ \tau λ \l原创 2015-03-29 12:15:25 · 5604 阅读 · 0 评论 -
Matlab diag的用法
X = diag(v,k)以向量v的元素作为矩阵X的第k条对角线元素,当k=0时,v为X的主对角线;当k>0时,v为上方第k条对角线几个例子:当k> v=[1 2 3];>> x=diag(v,-1)x =0 0 0 01 0 0 00 2 0 00 0 3 0v=[1];x=diag(v,0)x=1 0 0 00原创 2015-03-29 12:30:30 · 3467 阅读 · 1 评论 -
Matlab .asv是什么文件
有时在存放m文件的文件夹中会出现*.asv asv 就是auto save的意思,*.asv文件的内容和相应的*.m文件内容一样,用记事本和matlab都能打开它。它可以作为*.m文件的“备份”。 可以在preference中通过设置取消自动备份功能:file->preferences->editor/debugger-->auto save,uncheck "aut原创 2015-03-29 08:40:40 · 38614 阅读 · 0 评论 -
matlab中常数下的点是什么意思
加上点“.”后表示两个矩阵或向量对应位置进行运算,这时候要求进行操作的两个变量必须维数相同(与矩阵乘法对矩阵维数要求不同)原创 2015-03-29 08:36:37 · 5660 阅读 · 0 评论 -
Matlab 根号的输入
二次根号:sqrt(a)或a^0.5三次根号:x^(1/3)或者x.^(1/3)根据x的数据结构类型矩阵、数组需要.^原创 2015-03-29 08:16:33 · 21741 阅读 · 0 评论 -
Matlab arenstorf problem
% right-hand side of arenstorf problemfunction yDot = arenstorf(t,y)global mu muHat% unpack yu1 = y(1);u2 = y(2);u1Dot = y(3);u2Dot = y(4);% define variables of conveniencer1 = ((u1+mu)^2原创 2015-03-28 07:42:41 · 1571 阅读 · 0 评论 -
Matlab adaptive quadrature
% script to perform adaptive quadratureclear all, close allglobal pts% function to be integrated defined in routine ff = 'integrand';a = 1; b = 3;pts = [a;b];tol = input('Enter error toleran原创 2015-03-31 10:07:36 · 1590 阅读 · 1 评论 -
matlab 的解函数的不同方式
f=@(x)(sin(x)+2*x);f(pi/2)f=sym('sin(x)+2*x');subs(f,'x',pi/2)f=inline('sin(x)+2*x');f(pi/2)原创 2015-03-31 14:38:55 · 1259 阅读 · 0 评论 -
matlab中syms与sym有什么区别
syms x y %就是定了符号变量x y以后x y就可以直接使用了,有他们运算出来的结果也是符号变量当然上面的也可以x=sym('x'),y=sym('y')sys('a+b')%就是将a+b转化为符号表达式两者有不同的使用场合比如符号变量涉及的个数比较少,但是使用频率比较高,那么就是使用syms但是如果个数多,但是使用频率比较少 则使用sym原创 2015-03-31 15:16:32 · 22301 阅读 · 0 评论 -
What does operator “dot” (.) mean?
Question:Given the code : A = [1 2 3; 3 2 1] B = A.^2The output : B = 1 4 9 9 4 1But if I do this : B = A^2The output is :Error using ^ Inputs must be a原创 2015-04-15 08:51:41 · 612 阅读 · 0 评论 -
matlab rank
k =rank(A) %a is matrixs = svd(A);tol = max(size(A))*eps(max(s));r = sum(s > tol);原创 2015-04-10 03:04:04 · 3753 阅读 · 0 评论 -
matlab 怎样输入pi
本身就是matlab里的常数,直接输pi原创 2015-04-01 05:41:27 · 8413 阅读 · 0 评论 -
Matlab disp()
matlab中disp()就是屏幕输出函数,类似于c语言中的printf()函数原创 2015-04-01 06:38:20 · 2639 阅读 · 0 评论 -
Matlab The Secant method(2)
f=@(x) x^2 - 612;x(1)=10;x(2)=30;for i=3:7 x(i) = x(i-1) - (f(x(i-1)))*((x(i-1) - x(i-2))/(f(x(i-1)) - f(x(i-2))));endroot=x(7)原创 2015-03-19 01:58:31 · 1219 阅读 · 0 评论 -
spline和Pchips的不同(matlab)
这是一条官方的链接:http://blogs.mathworks.com/cleve/2012/07/16/splines-and-pchips/主要是比较在matlab中spline和Pchips不同点及相关的例子,比较经典,因为英文比较简单,我就不翻译了。原创 2015-04-03 01:20:29 · 1704 阅读 · 0 评论 -
Gauss-Laguerre quadrature rule
% matlab script to derive the 2-point Gauss-Laguerre quadrature rule% and use it on an example% inelegantly set up equations from method of undetermined coefficients% and solveclear all close a原创 2015-04-01 01:06:49 · 1308 阅读 · 0 评论 -
how to use the mathmatical constant "e" in conjunction with a vector
e=exp(1);原创 2015-04-01 00:58:13 · 398 阅读 · 0 评论 -
code for qint function
function [p,y,a] = qint(ym1,y0,yp1)%QINT - quadratic interpolation of three adjacent samples%% [p,y,a] = qint(ym1,y0,yp1)%% returns the extremum location p, height y, and half-curvature a%原创 2015-04-03 02:06:20 · 1509 阅读 · 0 评论 -
matlab @
变量名=@(输入参数列表)运算表达式例如, 前面那个计算变量平方的函数可以简单地写为这个匿名函数:mysqr1=@(x)x.*x之后, 执行mysqr1(变量名), 即可计算该变量的平方, 注意, mysqr1属性是函数句柄变量, 而不是这个表达式; 还有要注意这个表达式不需要用单引号括起来原创 2015-03-31 09:30:57 · 1675 阅读 · 2 评论 -
Matlab quad
1x3−2x−5dx, (from 0 to 1)write a function myfun that computes theintegrand:function y = myfun(x) y = 1./(x.^3-2*x-5);Then pass @myfun, a function handle to myfun,to quad, along with t原创 2015-03-31 10:15:37 · 5686 阅读 · 0 评论 -
matlab的解方程的例子
syms x yz=exp(2*x+y)+cos(3*x*y)-exp(1)-1;zz=subs(z,x,1)solve(zz)原创 2015-03-31 15:25:21 · 1863 阅读 · 0 评论 -
Matlab Error (Matrix dimensions must agree)
xOld =input('Enter initial guess: '); errortmp =2;counter =0; while (errortmp>10^-10)xNew =xOld - Jf3(xOld)\f3(xOld)counter=counter+1error=norm(xNew-xOld,inf)+4*eps*norm(xNew,inf)if(原创 2015-03-17 07:38:14 · 12753 阅读 · 1 评论 -
Matlab 随机数字
1.随机生成只有0,1元素的矩阵(m行n列)A=round(rand(m,n))2.随机生成每行有若干个0,1元素的矩阵,比如每行只有2个元素为1,其他元素为0A=zeros(4,5)for i=1:4 A(i,:)=randperm(5); for j=1:5 if A(i,j) A(i,j)=1;原创 2015-03-17 14:55:55 · 1125 阅读 · 0 评论 -
Matlab piecelin
function v = piecelin(x,y,u)%PIECELIN Piecewise linear interpolation.% v = piecelin(x,y,u) finds the piecewise linear L(x)% with L(x(j)) = y(j) and returns v(k) = L(u(k)).% First divided diff原创 2015-03-13 07:45:24 · 1405 阅读 · 0 评论 -
Matlab pchiptx
function v = pchiptx(x,y,u)%PCHIPTX Textbook piecewise cubic Hermite interpolation.% v = pchiptx(x,y,u) finds the shape-preserving piecewise cubic% interpolant P(x), with P(x(j)) = y(j), and ret原创 2015-03-13 07:45:44 · 1558 阅读 · 0 评论 -
matlab floatgui
function floatgui(callbackarg)%FLOATGUI Show structure of floating point numbers.% The set of positive model floating point numbers is determined% by three parameters: t, emin, and emax. It is原创 2015-03-13 05:25:01 · 676 阅读 · 0 评论 -
Matlab interpgui
function interpgui(arg1,arg2)%INTERPGUI Behavior of interpolating functions.% Demonstrates interpolation by a piecewise linear interpolant,% a polynomial, a spline, and a shape preserving Herm原创 2015-03-13 07:44:07 · 974 阅读 · 0 评论 -
matlab deckShuffling
% a script to determine how many perfect shuffles are required% before a given deck of cards returns to its original orderclear all, close all% problem statement:% suppose we have a deck of 8 (d原创 2015-03-13 05:21:26 · 619 阅读 · 0 评论 -
Matlab lugui
function [L,U,pv,qv] = lugui(A,pivotstrat)%LUGUI Gaussian elimination demonstration.%% LUGUI(A) shows the steps in LU decomposition by Gaussian elimination.% At each step of the elimination, t原创 2015-03-13 07:39:41 · 686 阅读 · 0 评论 -
Matlab pivotgolf
function scoreout = pivotgolf(course,pivotstrat)% PIVOTGOLF Pivot Pickin' Golf.% Your goal is to use LUGUI to compute the LU decompositions of nine% matrices with as little roundoff error as原创 2015-03-13 07:41:29 · 631 阅读 · 0 评论 -
Matlab lorenzgui
function lorenzgui%LORENZGUI Plot the orbit around the Lorenz chaotic attractor.% This function animates the integration of the three coupled% nonlinear differential equations that define the原创 2015-03-13 07:49:44 · 1243 阅读 · 0 评论 -
matlab perfectShuffle
function newDeck = perfectShuffle(oldDeck)% PERFECTSHUFFLE% function to perform perfect shuffle on a deck with an even number% of cardsN = length(oldDeck);newDeck = zeros(N,1);N2 = N/2;newDe原创 2015-03-13 05:22:43 · 845 阅读 · 0 评论 -
matlab hornerDemo
% a quick demo of Horner's method and its effectsclear allclose all% first a comparison of ways to computex = 0.988:.0001:1.012;y1 = x.^7-7*x.^6+21*x.^5-35*x.^4+35*x.^3-21*x.^2+7*x-1;plot(x,y原创 2015-03-13 05:26:26 · 1274 阅读 · 0 评论