Frequency Response

Natural frequency

  • wn = sqrt(k/m)(rad/s) - 회전 주파수
  • fn = wn/(2*pi)(Hz) - 주파수
1
2
3
4
5
6
7
8
>> m=10;
>> b=0.1;
>> k=1000;
>> wn=sqrt(k/m)

wn =

10
Read more »

TF&state-space

1
2
3
4
5
6
7
8
9
10
11
12
syms Y s y(t) t

laplace(10*diff(diff(y(t)))+0.4*diff(y(t))+4*y(t))
Y1=s*Y;
Y2=s*Y1;
sol=solve(10*Y2+0.4*Y1+4*Y-1,Y);
pretty(sol)

num=[1];
den=[10 0.4 4];
h=tf(num, den);
[A,B,C,D]=tf2ss(num, den)
Read more »

m=10kg, c=0.4Ns/m, k=4Nm(Mass-Spring-Damper System)

General solution, Natural response, Step response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
syms x y;
u=dsolve('D2y+0.04*Dy+0.4*y=0','x')
U=dsolve('D2y+0.04*Dy+0.4*y=0','y(0)=1','Dy(0)=1','x');
subs_U=subs(U,x,0:0.1:250);
t=0:0.1:250;
plot_U=double(subs_U);
plot(t,plot_U)
hold on

figure
num=[1];
den=[10 0.4 4];
h=tf(num, den);
step(h)
Read more »

Transfer Function

tf?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
>> help tf
tf - Transfer function model

Use tf to create real-valued or complex-valued transfer function models, or to
convert dynamic system models to transfer function form.

sys = tf(numerator,denominator)
sys = tf(numerator,denominator,ts)
sys = tf(numerator,denominator,ltiSys)
sys = tf(m)
sys = tf(___,Name,Value)
sys = tf(ltiSys)
sys = tf(ltiSys,component)
s = tf('s')
z = tf('z',ts)
Read more »

Mass-Spring-Damper System

1
2
3
4
5
6
7
8
9
10
11
h=tf([1 4],[1 4 40])
pole(h)
zero(h)
figure
step(h)

h1=tf([10 40],[1 4 40])
pole(h1)
zero(h1)
figure
step(h1)
Read more »

Bar Plots

1
2
3
x = -2.9:0.2:2.9;
y = exp(-x.*x);
bar(x,y)

Stairstep Plots

1
2
3
x = 0:0.25:10;
y = sin(x);
stairs(x, y)
Read more »

MNIST 데이터셋

  • 훈련용 6만개와 테스트용 1만개로 이루어진 손글씨 숫자의 흑백이미지 데이터 - 여기서 다운
  • 이미지를 다루는 경우 데이터 전처리나 포맷팅이 시간이 많이 걸리므로 이 데이터셋을 이용함
  • 가로세로 비율은 그대로 유지하고 20x20 픽셀로 정규화(normalization)되어 있음
  • 정규화 알고리즘(가장 낮은 것에 맞춰 전체 이미지 해상도를 감소시킴)에 사용된 anti-aliasing 처리 때문에 이미지에 회색 픽셀이 들어 있음
  • 이미지의 중심을 계산하여 28x28 픽셀 크기의 프레임 중앙에 위치

MNIST 데이터셋

Read more »

Clustering

  • 선형 회귀분석은 모델을 만들기 위해 입력 데이터와 출력 값(label)을 사용해 감독(Supervised) 학습 알고리즘
  • 모든 데이터에 레이블이 있지 않음
  • 비감독(Unsupervised) 학습 알고리즘
  • 데이터 분석의 사전 작업으로 사용되기 좋음

K-means Clustering

  • 데이터를 다른 묶음과 구분되도록 유사한 것끼리 자동으로 Grouping
  • 알고리즘에 예측해야 할 타겟 변수나 결과 변수가 없음
  • 텐서(Tensor) 이용
Read more »

TensorFlow를 이용한 간단한 곱셈 프로그램

1
2
3
4
5
6
7
8
9
10
import tensorflow as tf

a = tf.placeholder("float")
b = tf.placeholder("float")

y = tf.multiply(a, b)

sess = tf.Session()

print(sess.run(y, feed_dict={a: 3, b: 3}))
Read more »