You are on page 1of 15

Matlab Basic

Topic
Introduction Matlab Matrix Manipulation Signal Generate Fourier Theorem Matlab Concept PSCAD to Matlab Conclusion

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

Menu bar

Workspace Command windown Command history

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

Arithmetic Operators
Name Addition Subtraction Multiplication Division Array right division Matrix left division Operator + * / ./ \

Matlab Operator
A+B A-B A*B A/B A./B A\B, A*inv(B)

Array left division Matrix power

.\ ^

A.\B A^b

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

Relational & Logic Operators


Name Less Less than or equal Greater Greater than or equal Equal Not Equal Operator < <= > >= == ~=

Matlab Operator
X < 10 X <= 10 X > 10 X >= 10 X == 1 X ~= 5

And Or
Not

& |
~

X>2&y<1 X>2|y<1
~x

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion Relational & Logic Operators Name sin cos tan arc sin arc cos arc tan Matlab sin(x) cos(x) tan(x) asin(x) acos (x) atan(x)

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion a = [1 2 3]

1 2
a = [1

2 3;4 5 6;7 8 9] 1 4 7 2 3 5 6 8 9

a = ? 1 2 3 4 7 5 8 6 9

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

b = a(3,2)
8 b = a(1:2, 1:2) 1 2 4 5 b = a(1:2, 1:2) 5 6 8 9

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

1 2 4 5 7 8

3 6 9

1 3 7 9

=?

A(1:2:3,1:2:3)

1 3 =? 4 6

A(1:2,1:2:3)

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion 1 a= 4 7 2 5 8 3 6 9 9 8 b= 6 5 3 2 7 4 1

a*b = 30 84 138 a.*b = 9 24 21 16 21 25 24 16 9 24 69 114 18 54 90

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion
f (t ) A0 A1 cos(t 1 ) A2 cos(2t 2 ) ... An cos( nt n )

t = 0:0.000625:0.1; w = 2*pi*50; ft = 3*cos(w*t); plot(t, ft, r)

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion ft = 12+72cos(wt)+64cos(2wt)+25cos(7wt)+46cos(9wt)

Topic
f (t ) A0 A1 cos(t 1 ) A2 cos(2t 2 ) ... An cos( nt n ) > Introduction > Matrix > Signal Gen. f (t ) a0 (an cos nt bn sin nt ) n 1 > Fourier Theorem T > Matlab Concept 1 a0 f (t )dt > PSCAD To Matlab T0 > Conclusion
2 an f (t )cos ntdt T0 2 bn f (t )sin ntdt T0
T T

An an 2 bn 2

= atan ) (

Topic
Fourier code > Introduction > Matrix t=0.02/128:0.00015625:0.02; > Signal Gen. w = 2*pi*50; > Fourier Theorem ft =12+72*sin(w*t + 3 )+53*sin(3*w*t+ 6 )+37*sin(5*w*t+ 6 ); > Matlab Concept x1 = cos(w*t); > PSCAD To Matlab x2 = sin(w*t); > Conclusion a1 = (2*sum(ft.*x1))/128; b1 = (2*sum(ft.*x2))/128; A = sqrt(a1^2+b1^2)
Arms = A/sqrt(2)

Topic
> Introduction > Matrix > Signal Gen. > Fourier Theorem > Matlab Concept > PSCAD To Matlab > Conclusion

You might also like