文档详情

5数值计算功能5数值计算功能.docx

发布:2017-01-01约9.65千字共8页下载文档
文本预览下载声明
clear;close;clc;A=[1 2 3;4 5 6]A = 1 2 3 4 5 6 A=[1:3;4:6]A = 1 2 3 4 5 6A=zeros(2,3)A = 0 0 0 0 0 0A=eye(3,3)A = 1 0 0 0 1 0 0 0 1C=hadamard(4)C = 1 1 1 1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1helptoeplitzTOEPLITZ Toeplitz matrix. TOEPLITZ(C,R) is a non-symmetric Toeplitz matrix having C as itsfirst column and R as its first row. TOEPLITZ(R) is a symmetric Toeplitz matrix for real R. For a complex vector R with a real first element, T = toeplitz(r) returns the HermitianToeplitz matrix formed from R. When the first element of R is not real, the resulting matrix is Hermitianoff the main diagonal, i.e., T_{i,j} = conj(T_{j,i}) for i ~= j. Class support for inputs C,R:float: double, single See also HANKEL. Overloaded methods:sdpvar/toeplitzncvar/toeplitzA=[1 2 3];B=4:6;C1=cat(1,A,B)C1 = 1 2 3 4 5 6C2=cat(2,A,B)C2 = 1 2 3 4 5 6C3=cat(3,A,B)C3(:,:,1) = 1 2 3C3(:,:,2) = 4 5 6horzcat(A,B)ans = 1 2 3 4 5 6vertcat(A,B)ans = 1 2 3 4 5 6A=1:9;A=reshape(A,3,3)A = 1 2 3 4 5 6 7 8 9A(2,3)ans = 6A(8)ans = 6B=A(1:2,:)B = 1 2 3 4 5 6A(:,[1 2])=[]A = 3 6 9C=reshape(B,1,6)C = 1 4 2 5 3 6A*C(1:3)ans = 3 12 6 6 24 12 9 36 18Cans = 1 4 2 5 3 6x=sdpvar(1,3)%f=[2 -2 3]*xf=2*x(1)-2*x(2)+3*x(3)F=set(x(1)=0)+set(x(2)=0)%F=F+set([-1 1 1]*x=4)+set([-1 1 1]*x=4)+set([-2 1 -1]*x=6)F=F+set([-1 1 1]*x==4)+set([-2 1 -1]*x=6)solvesdp(F,f)double(f)double(x)Linear matrix variable 1x3 (full, real, 3 variables)Linear scalar (real, 3 variables)+++++++++++++++++++++++++++++++++++++++++++++++++++++++| ID| Constraint| Type|+++++
显示全部
相似文档