1) sound

load handel
sound(y,Fs)
which handel.mat

2) ddang.m

draw 2 cards
each card : number of 1 to 10
38 광땡 → train sound : load train; sound(y,Fs)
땡 → gong sound : load gong; sound(y,Fs)
망통 → laughter sound : load laughter; sound(y,Fs)

Early iteration stop (see and run : testbreak.m)

3) break

terminates loop
In nested loops, BREAK exits from the loop that it belongs to

4) continue

passes control to the next iteration

5) return

causes a return to the invoking function or to the keyboard

General Form of Function

6) function maxij (finding maximum element)

Find max value and its location from input matrix
function [amax, i, j] = maxij(a)
a : input matrix
amax : max value of a
i,j : row and col index of amax in a
use [vmax, i] = max(v)

7) Newton's method for solving f(x) = 0

% myNewton.m
%
% This program finds a root of function func1().

x = input('Type initial guess --> ');
fx = func1(x);
dx = 1e-8;
i = 0; % 몇 번 도는지 보기 위함

while abs(fx) > 1e-10 % 내가 생각하기에 충분히 작은 수. ~=로 대체하면 무한 루프가 되어버림.

    i = i+1
    fx = func1(x);
    dfx = ( func1(x+dx) - func1(x) ) / dx;
    x = x - fx/dfx;

end

0개의 댓글