'Matlab'에 해당 되는 글 9건

  1. 2012.07.01 [MATLAB] plot의 글자크기(font size) 및 모양 변경하기 ylabel, xlabel, legend
  2. 2010.01.17 [MATLAB] rlocus를 이용해 root locus 그리기 2
  3. 2010.01.17 [MATLAB] dsolve를 이용해 상미분방정식 풀기
  4. 2010.01.17 [MATLAB] laplace를 이용해 라플라스 변환 구하기
  5. 2010.01.17 [MATLAB] slu.m을 이용하여 주어진 matrix를 LU분해하기
  6. 2009.10.19 [MATLAB] mesh와 meshgrid를 이용한 3차원 그래프 그리기
  7. 2009.10.19 [MATLAB] 전달함수로 부터 control canonical form 얻기
  8. 2009.10.19 [MATLAB] symbolic 객체를 이용한 적분
  9. 2009.10.19 [MATLAB] matlab에서 수치적분 하기 quad
2012. 7. 1. 10:45

[MATLAB] plot의 글자크기(font size) 및 모양 변경하기 ylabel, xlabel, legend

clear all; clc

t = 0:0.01:2*pi;

alpha = sin(t);


plot(t,alpha);


xlabel(['\fontname{times new roman}' '\itt\rm'], 'fontsize', 30)


h_ylabel = ylabel('\it\alpha\rm(\itt\rm)');

set(h_ylabel, 'fontname', 'times new roman', 'fontsize', 30);


h_legend = legend('\it\alpha=\rmsin(\itt\rm)');

set(h_legend, 'fontname', 'times new roman', 'fontsize', 30)





2010. 1. 17. 10:47

[MATLAB] rlocus를 이용해 root locus 그리기

\begin{align*} G(s) = \frac{s + 3}{s^{2} + 3s + 2} \end{align*}

소스


clear all
num = [1 3]; %전달함수의 분자의 계수
den = [1 3 2]; %전달함수의 분모의 계수
G = tf(num,den);
rlocus(G);
axis('equal'); %좌표축 간격을 일정하게 세팅



결과
사용자 삽입 이미지

2010. 1. 17. 10:42

[MATLAB] dsolve를 이용해 상미분방정식 풀기

\begin{align*} y'' + 3y' + 2y = t, \; y(0) = 0, \: y'(0) = 0 \end{align*}


소스


clear all
syms y t;
sol = dsolve('D2y+3*Dy+2*y = sin(t)','y(0)=0', 'Dy(0)=0');
pretty(sol);

결과
사용자 삽입 이미지

2010. 1. 17. 10:36

[MATLAB] laplace를 이용해 라플라스 변환 구하기

소스

clear all
syms t a b;
F = t^2 + sin(a*t) - t*cos(b*t);
L = laplace(F);
pretty(L);



결과

사용자 삽입 이미지

2010. 1. 17. 10:34

[MATLAB] slu.m을 이용하여 주어진 matrix를 LU분해하기

Note : Gauss elimination 과정에서 row exchange가 필요하지 않은 matrix의 경우에만 사용할 수 있는 함수이다.



소스


clear all
A = [1 1 1; 1 2 3; 0 2 5];
[L U] = slu(A)


결과


L =

     1     0     0
     1     1     0
     0     2     1


U =

     1     1     1
     0     1     2


첨부파일 출처 : http://web.mit.edu/18.06/www/Course-Info/Tcodes.html

2009. 10. 19. 20:29

[MATLAB] mesh와 meshgrid를 이용한 3차원 그래프 그리기

소스


clear all
[x y] = meshgrid(-2:.2:2, -2:.2:2);
z = x.*exp(-x.^2 - y.^2);
mesh(z)

결과


사용자 삽입 이미지
2009. 10. 19. 20:27

[MATLAB] 전달함수로 부터 control canonical form 얻기


전달함수로 부터 control canonical form으로 나타낸 system matrix, input matrix, output matrix, direct transmission term 을 구한다.


소스


clear all
num = [1 2];
den = [1 7 12];
[F G H J] = tf2ss(num,den)

결과


F =

    -7   -12
     1     0


G =

     1
     0


H =

     1     2


J =

     0

2009. 10. 19. 20:26

[MATLAB] symbolic 객체를 이용한 적분

소스


clear all
syms x y;
y = x^2;
int(y,x)

결과


ans =
 
1/3*x^3
2009. 10. 19. 20:24

[MATLAB] matlab에서 수치적분 하기 quad

표준정규분포에서 0<X<2 일 확률을 적분을 통해 구하면


소스


clear all
quad('1/sqrt(2*pi)*exp(-t.^2/2)',0,2)

결과


ans =

    0.3333