% KTE/PPEL - Lenka Sroubova % 2. prednaska 2.10.2018 % zaznam z prikazoveho okna MATLABu % --------------------------------- A = [1,2,3;4,5,6] A = 1 2 3 4 5 6 A' ans = 1 4 2 5 3 6 A.' ans = 1 4 2 5 3 6 B=[1,2-i,3-4i;5+6i,7+8i,9+i] B = 1.0000 + 0.0000i 2.0000 - 1.0000i 3.0000 - 4.0000i 5.0000 + 6.0000i 7.0000 + 8.0000i 9.0000 + 1.0000i B' ans = 1.0000 + 0.0000i 5.0000 - 6.0000i 2.0000 + 1.0000i 7.0000 - 8.0000i 3.0000 + 4.0000i 9.0000 - 1.0000i B.' ans = 1.0000 + 0.0000i 5.0000 + 6.0000i 2.0000 - 1.0000i 7.0000 + 8.0000i 3.0000 - 4.0000i 9.0000 + 1.0000i r='ahoj' r = 'ahoj' r(2) ans = 'h' b="ahoj" b = "ahoj" b(2) {Index exceeds matrix dimensions. } % nelze b ma rozmer 1x1 whos Name Size Bytes Class Attributes A 2x3 48 double B 2x3 96 double complex ans 1x1 2 char b 1x1 134 string r 1x4 8 char clear A whos Name Size Bytes Class Attributes B 2x3 96 double complex ans 1x1 2 char b 1x1 134 string r 1x4 8 char clear whos clc; clear sin(pi) ans = 1.2246e-16 sind(180) ans = 0 plot(3,5) plot(3,5,'p') plot(3,5,'kp') plot(3,5,'rp') y=[5,6,8,4,1,3]; plot(y) x=0:2*pi x = 0 1 2 3 4 5 6 y=sin(x) y = 0 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 plot(x,y) x=0:0.5:2*pi; y=sin(x); plot(x,y) x=0:0.1:2*pi; y=sin(x); plot(x,y) plot(x,y,'mo--') plot(x,y,'m--') xlabel('x') ylabel('y') a=[3,4,6]; b=[7,0,-1]; plot(a,b) plot(a,b,'ko') A=[1,2,3;4,5,-6] A = 1 2 3 4 5 -6 size(A) ans = 2 3 v=size(A) v = 2 3 radek=v(1) radek = 2 sloupcu=v(2) sloupcu = 3 [r,s]=size(A) r = 2 s = 3 [r,s]=size(a) r = 1 s = 3 sum(a) ans = 13 a a = 3 4 6 sum(a) ans = 13 graf R1 = 5; R2 = 6; R = soucet(R1,R2) R = 11 r1 =7; r2=8; R = soucet(r1,r2) R = 15 x=5;y=3; z = soucet(x,y) z = 8 z = soucet(10,20) z = 30 odpory = [10,20,30,60,80,100]; R = seriove(odpory) R = 300 a a = 3 4 6 R = seriove(a) R = 13 seriove_spojeni_odporu = seriove(a) seriove_spojeni_odporu = 13 velbloudiStyl = seriove(odpory) velbloudiStyl = 300 clear velbloudiStyl = seriove([3,5,9,4]) velbloudiStyl = 21 whos Name Size Bytes Class Attributes velbloudiStyl 1x1 8 double R = paralelne(5,10) R = 3.3333 R = paralelne(5,5) R = 2.5000 8^(1/3) ans = 2 9^(1/2) ans = 3 sqrt(9) ans = 3 help paralelne 2 odpory paralelne help soucet seriove spojeni 2 odporu [Is,Ip] = vypocet_proudu(20,20,100) Is = 2.5000 Ip = 10 whos Name Size Bytes Class Attributes Ip 1x1 8 double Is 1x1 8 double R 1x1 8 double ans 1x1 8 double velbloudiStyl 1x1 8 double disp(Ip) 10 disp(Is) 2.5000 disp('ahoj') ahoj proudy(10,10,50) proud seriovym spojenim 2.5000 proud paralelnim spojenim 10 clear proudy(10,10,50) proud seriovym spojenim 2.5000 proud paralelnim spojenim 10 whos proud proud seriovym spojenim R1 a R2 2.5000 proud paralelnim spojenim R1 a R2 10 whos Name Size Bytes Class Attributes Ip 1x1 8 double Is 1x1 8 double R1 1x1 8 double R2 1x1 8 double Rp 1x1 8 double Rs 1x1 8 double U0 1x1 8 double proud proud seriovym spojenim R1 a R2 2.5000 proud paralelnim spojenim R1 a R2 10 clear [S,o] = kruh(10) S = 314.1593 o = 62.8319 [S,o] = kruh(10); [S,o] = kruh([10,20,50]) S = 1.0e+03 * 0.3142 1.2566 7.8540 o = 62.8319 125.6637 314.1593 format long pi ans = 3.141592653589793 format bank 70/54 ans = 1.30 format rat 7/8 ans = 7/8 70/10 ans = 7 70/4 ans = 35/2 pi ans = 355/113 format format short 70/4 ans = 17.5000 format short e 70/4 ans = 1.7500e+01 format short g 70/4 ans = 17.5 1456789*4500015647987864354 ans = 6.5556e+24 format diary off