Matlabベース構文規則
18199 ワード
% != ==
%clear all;
% clc
%Ctrl+R
%Ctrl+T
%
%Matlab 1
a=[1 2 3;4 5 6];
b=a.*10;% *10
%
c=ones(10);%10*10 matrix
d=ones(2,3);
e=zeros(3);% 3*3
f=zeros(2,3);
%hilb
hi=hilb(3);
%teoplitz
toe=toeplitz(4);
%
ra=rand(2);
%
rn=randn(2);
%
ar=a(1,:);%
ac=a(:,1);%
ab=[a;b];
%
rank(ab);
%
det(rn);
%
temp=ab;
temp(:,2)=[];
q=a(1,2);% 1
p=a(2);%
%in/output
fprintf('Hello World,%d
',a(1));
%
if a(1)>0
fprintf('bigger
');
elseif a(1)==0
fprintf('equal
');
else
fprintf('smaller
');
end
switch a(3)
case 1
fprintf('1
');
case 2
fprintf('2
');
otherwise
fprintf('other
');
end
%for while
for i=1:1:4
fprintf('%f,hello
',i);
end
i=0;
while i<=10
i=i+1;
fprintf('%f',i);
end
% , qfun.m
% function v=qfun(x1,x2)
% v=20+x1.^2+x2.^2-10*(cos(2*pi*x1)+cos(2*pi*x2));
%
%figure
x=-10:0.1:10;
y=x.^2;
plot(x,y,'*','LineWidth',1.5,'MarkerSize',2);
hold on;%hold
z=x.^3;
plot(x,z,'LineWidth',1.5);
title(' 1');
hold off;
%
% xoy
[x,y]=meshgrid(x,y);
t=x^2+y;
%
mesh(x,y,t);
figure;
%
surf(x,y,t);
%
[t1,t2,t3]=peaks(5);
mesh(t1,t2,t3);
%
%
p=[3 -10 0 15 10000];%
%
r=roots(p);
%
k=polyder(p);
%
kk=polyint(p);
%
%
num=normrnd(75,1.5,5,10);% 75, 1.5,5*10
%
var(num);%
std(num);%
mean(num);%
%
normplot([num,1.5*num]);
%
num1=normrnd(75,1.5,1,10);
histfit(num1);
% /APP