掲示板

スマホで数値計算(山崎純一)

10_フーリエ変換

% 2021-08-13 Ver 1.

% フーリエ変換するデーターを読込み、プロット
F0 = importdata('FFTTest-01.txt');
plot (F0)

% F0の1から300番目を取り出しプロット
F0s = F0(1:300,:);
plot (F0s)

% フーリエ変換し、プロット
t = 0.01; % サンプリング周期
l = 1024; % データー点数
F1 = fft(F0); % フーリエ変換
F2 = abs(F1/l);
F3 = F2(1:l/2+1);
ts = 1/t;
tt = ts*(0:(l/2))/l;
plot (tt,F3)

% 横軸を拡大
xlim([0,20])

 

06_二次元グラフ

% 2021-8-13 Ver 1.00

% 関数を-5 5の区間でプロット
fplot(@(x) sin(x))


% 関数を0 5の区間でプロット
fplot(@(x) 3*sin(x)^2+cos(x),[0 5])


% 関数を2ポイントのラインでプロット
fplot(@(x) sin(x+pi/5),'Linewidth',2)


% 関数を2ポイントのラインでプロット
fplot(@(x) sin(x+pi/5),'Linewidth',2);
hold on
fplot(@(x) sin(x^2+pi/5),'--or');
fplot(@(x) sin(x^3+pi/3),'-.*c');
hold off