Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is a Classroom License for instructional use only.
- Research and commercial use is prohibited.
- >> A=[1 3;5 9]
- A =
- 1 3
- 5 9
- >> B=[4 -7;10 0]
- B =
- 4 -7
- 10 0
- >> x=1; M=[3*x, 1-2*x;x, x*x-1]
- M =
- 3 -1
- 1 0
- >> A+B
- ans =
- 5 -4
- 15 9
- >> A-B
- ans =
- -3 10
- -5 9
- >> A*B
- ans =
- 34 -7
- 110 -35
- >> A'
- ans =
- 1 5
- 3 9
- >> A=[1 2 3;2 3 1; 3 1 2];
- >> inv(A)
- ans =
- -0.2778 0.0556 0.3889
- 0.0556 0.3889 -0.2778
- 0.3889 -0.2778 0.0556
- >> B=[2;4;6;8]
- B =
- 2
- 4
- 6
- 8
- >> inv(B)
- Error using inv
- Matrix must be square.
- >> A
- A =
- 1 2 3
- 2 3 1
- 3 1 2
- >> det(A)
- ans =
- -18
- >> Z1=5+i
- Z1 =
- 5.0000 + 1.0000i
- >> abs(Z1)
- ans =
- 5.0990
- >> Z2=6.5+2i
- Z2 =
- 6.5000 + 2.0000i
- >> angle(Z1)
- ans =
- 0.1974
- >> angle(Z2)
- ans =
- 0.2985
- >> real(Z1)
- ans =
- 5
- >> real(Z2)
- ans =
- 6.5000
- >> imag(Z1)
- ans =
- 1
- >> Z3=[3+2i,-i,-1-2i}
- Z3=[3+2i,-i,-1-2i}
- ↑
- Error: Unbalanced or unexpected parenthesis or bracket.
- Did you mean:
- >> Z3=[3+2i,-i,-1-2i]
- Z3 =
- 3.0000 + 2.0000i 0.0000 - 1.0000i -1.0000 - 2.0000i
- >> Z3'
- ans =
- 3.0000 - 2.0000i
- 0.0000 + 1.0000i
- -1.0000 + 2.0000i
- >> A=[4 2*PI;6i 10sqrt(2)+i]
- A=[4 2*PI;6i 10sqrt(2)+i]
- ↑
- Error: Unexpected MATLAB expression.
- Did you mean:
- >> A = [4 2*PI;6i 10*sqrt(2) + i]
- Undefined function or variable 'PI'.
- Did you mean:
- >> A = [4 2*pi;6i 10*sqrt(2) + i]A
- A = [4 2*pi;6i 10*sqrt(2) + i]A
- ↑
- Error: Unexpected MATLAB expression.
- >> A
- A =
- 1 2 3
- 2 3 1
- 3 1 2
- >> A = [4 2*pi;6i 10*sqrt(2) + i]
- A =
- 4.0000 + 0.0000i 6.2832 + 0.0000i
- 0.0000 + 6.0000i 14.1421 + 1.0000i
- >> B=[6i -13*PI;PI 16]
- Undefined function or variable 'PI'.
- Did you mean:
- >> B=[6i -13*pi;pi 16]
- B =
- 0.0000 + 6.0000i -40.8407 + 0.0000i
- 3.1416 + 0.0000i 16.0000 + 0.0000i
- >> A*B
- ans =
- 1.0e+02 *
- 0.1974 + 0.2400i -0.6283 + 0.0000i
- 0.0843 + 0.0314i 2.2627 - 2.2904i
- >> B*A
- ans =
- 1.0e+02 *
- 0.0000 - 2.2104i -5.7757 - 0.0314i
- 0.1257 + 0.9600i 2.4601 + 0.1600i
- >> x=[1 2 3]; y=[0 1 0];
- >> 2*x
- ans =
- 2 4 6
- >> x. *y
- x. *y
- ↑
- Error: Unexpected MATLAB operator.
- >> x.*y
- ans =
- 0 2 0
- >> x*y
- Error using *
- Inner matrix dimensions must agree.
- >> A=eye(3)
- A =
- 1 0 0
- 0 1 0
- 0 0 1
- >> B=ones(2,4)
- B =
- 1 1 1 1
- 1 1 1 1
- >> C=zeros(3,4)
- C =
- 0 0 0 0
- 0 0 0 0
- 0 0 0 0
- >> D=rand(2,3)
- D =
- 0.8147 0.1270 0.6324
- 0.9058 0.9134 0.0975
- >> E=randn(2,3)
- E =
- -0.4336 3.5784 -1.3499
- 0.3426 2.7694 3.0349
- >> A=[5 4 3 2;0 9 8 7;1 2 3 4;7 6 5 4]
- A =
- 5 4 3 2
- 0 9 8 7
- 1 2 3 4
- 7 6 5 4
- >> F=diag(A)
- F =
- 5
- 9
- 3
- 4
- >> G=diag(A,2)
- G =
- 3
- 7
- >> H=rot90(A)
- H =
- 2 7 4 4
- 3 8 3 5
- 4 9 2 6
- 5 0 1 7
- >> repmat(A,n,m)
- Undefined function or variable 'n'.
- >> repmat(A,2,3)
- ans =
- 5 4 3 2 5 4 3 2 5 4 3 2
- 0 9 8 7 0 9 8 7 0 9 8 7
- 1 2 3 4 1 2 3 4 1 2 3 4
- 7 6 5 4 7 6 5 4 7 6 5 4
- 5 4 3 2 5 4 3 2 5 4 3 2
- 0 9 8 7 0 9 8 7 0 9 8 7
- 1 2 3 4 1 2 3 4 1 2 3 4
- 7 6 5 4 7 6 5 4 7 6 5 4
- >> A(:,:)
- ans =
- 5 4 3 2
- 0 9 8 7
- 1 2 3 4
- 7 6 5 4
- >> A(3,4)
- ans =
- 4
- >> A(2,:)
- ans =
- 0 9 8 7
- >> A(:,2)
- ans =
- 4
- 9
- 2
- 6
- >> A(:,4)
- ans =
- 2
- 7
- 4
- 4
- >> A(3,2:4)
- ans =
- 2 3 4
- >> A(2:3,2:4)
- ans =
- 9 8 7
- 2 3 4
- >> A(4,3)=0
- A =
- 5 4 3 2
- 0 9 8 7
- 1 2 3 4
- 7 6 0 4
- >> Q=[6 8; 9 12]
- Q =
- 6 8
- 9 12
- >> Q1=[Q;w]
- Undefined function or variable 'w'.
- >> w=[3 4]
- w =
- 3 4
- >> Q1=[Q;w]
- Q1 =
- 6 8
- 9 12
- 3 4
- >> Q1=vertcat(q,w)
- Undefined function or variable 'q'.
- Did you mean:
- >> Q1=vertcat(Q,w)
- Q1 =
- 6 8
- 9 12
- 3 4
- >> k=[5;6]
- k =
- 5
- 6
- >> Q2=[Q k]
- Q2 =
- 6 8 5
- 9 12 6
- >> Q2=horzcat(Q,k)
- Q2 =
- 6 8 5
- 9 12 6
- >> w=[2 3 2 3 2 3 2 3 2 3];
- >> N=ones(3,4)
- N =
- 1 1 1 1
- 1 1 1 1
- 1 1 1 1
- >> numel(w)
- ans =
- 10
- >> numel(N)
- ans =
- 12
- >> lenght(w)
- Undefined function or variable 'lenght'.
- Did you mean:
- >> length(w)
- ans =
- 10
- >> length(N)
- ans =
- 4
- >> w1=0:0.25:2
- w1 =
- 0 0.2500 0.5000 0.7500 1.0000 1.2500 1.5000 1.7500 2.0000
- >> length(w1)
- ans =
- 9
- >> w2=0:(1-0)/(11-1):1
- w2 =
- 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000
- >> w2=linspace(0,1,10)
- w2 =
- 0 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889 1.0000
- >> w2=linspace(0,1,11)
- w2 =
- 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000
- >> w3=linspace(0,300,7)
- w3 =
- 0 50 100 150 200 250 300
- >> w3=0:50:300
- w3 =
- 0 50 100 150 200 250 300
- >>
- >> w4=longspace(0,5,6)
- Undefined function or variable 'longspace'.
- Did you mean:
- >> w4=logspace(0,5,6)
- w4 =
- 1 10 100 1000 10000 100000
- >> v=longspace(0,3,5)
- Undefined function or variable 'longspace'.
- Did you mean:
- >> v=logspace(0,3,5)
- v =
- 1.0e+03 *
- 0.0010 0.0056 0.0316 0.1778 1.0000
- >> A=[2 3 1; 3 2 -1;1 1 1]
- A =
- 2 3 1
- 3 2 -1
- 1 1 1
- >> b=[9;-1;2];
- >> rozw=A\b
- rozw =
- -3.8000
- 5.4000
- 0.4000
- >> x=0.5
- x =
- 0.5000
- >> n=[1:5]
- n =
- 1 2 3 4 5
- >> z1=sum((x.^n)./n)
- z1 =
- 0.6885
- >> n=[1:10};
- n=[1:10};
- ↑
- Error: Unbalanced or unexpected parenthesis or bracket.
- Did you mean:
- >> n=[1:10];
- >> z2=sum((x.^n)./n)
- z2 =
- 0.6931
- >> n=[1:50];
- >> z3=sum((x.^n)./n)
- z3 =
- 0.6931
- >> n=[1:100];
- >> z4=sum((x.^n)./n)
- z4 =
- 0.6931
- >> format long,z1,z2,z3,z4
- z1 =
- 0.688541666666667
- z2 =
- 0.693064856150794
- z3 =
- 0.693147180559945
- z4 =
- 0.693147180559945
- >> format bank,z1,z2,z3,z4
- z1 =
- 0.69
- z2 =
- 0.69
- z3 =
- 0.69
- z4 =
- 0.69
- >> format rat,z1,z2,z3,z4
- z1 =
- 661/960
- z2 =
- 1549/2235
- z3 =
- 1588/2291
- z4 =
- 1588/2291
- >> b=1+(tan(t./2)).^2;
- Undefined function or variable 't'.
- >> plot(t,b)
- Undefined function or variable 't'.
- >> t=[1:10]
- t =
- Columns 1 through 7
- 1 2 3 4 5 6 7
- Columns 8 through 10
- 8 9 10
- >> b=1+(tan(t./2)).^2;
- >> plot(t,b)
- >> t=1:20;
- >> b=1+(tan(t./2)).^2;
- >> plot(t,b)
- >> t=1:0.1:20;
- >> b=1+(tan(t./2)).^2;
- >> t=1:0.1:20;
- >> b=1+(tan(t./2)).^2;
- >> plot(t,b)
- >> xlabel('t)
- xlabel('t)
- ↑
- Error: String is not terminated properly.
- >> xlabel('t')
- >> ylabel('b')
- >> title('wykres 1')
- >> plot(t,b)
- >> t=1:20;
- >> y=(t.^2)./sin(t.^3);
- >> plot(t,y)
- >> t=1:100;
- >> y=(t.^2)./sin(t.^3);
- >> plot(t,y)
- >> t=1:0.1:20;
- >> y=(t.^2)./sin(t.^3);
- >> plot(t,y)
- >> t=1:0.1:20;
- >> y=x^2
- y =
- 1/4
- >> plot(x,y)
- >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement