当前位置:网站首页>Matlab notes

Matlab notes

2022-06-25 04:56:00 xxxibolva

1. Display as a fraction

>> format rat
>> N./2

ans =1/2            1              3/2            2              5/2

2. produce 20 A random integer

>> n=randi([min,max],[i,j])  % Generate a row vector

[min,max]: The value range of the generated random integer

[i,j]:i That's ok j Column

3. Calculate average

>> avg=mean(n)  %n Is a vector or matrix

4. Generate row vectors

y = linspace(x1,x2)

y = linspace(x1,x2,n)

Generate [x1,x2] Yes n A uniformly spaced row vector ,n The default is 100

5. Percentage output

>>p=1543/3000*100;

>>sprintf('%2.2f%%',p)

ans ='51.43%'

 

Chapter four mapping

1. Graphics keep

hold on/off keep / Refresh the original drawing

No parameters hold Command to switch between two states

>> plot(x,y1) 
>> hold on  % keep
>> plot(x,y2)
>> hold off  % Refresh

notes : Do not close the drawing window halfway through the process !

2. Curve style

 

原网站

版权声明
本文为[xxxibolva]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210530474923.html