startup

Signal Processing + Visualization 중심의 Octave 학습 예제

oc ex/startup.m

코드 인덱스로 돌아가기

카테고리

Legacy Room

학습 소스 그룹

코드 길이

43

lines

작성자

-

날짜 정보 없음

패키지

io, signal

pkg load 기준

전체 코드

전체 코드를 복사해서 Octave에서 바로 실행할 수 있습니다.

% startup.m 파일은 프로젝트 루트에 위치한다.
% startup.m 세션이 시작할 떄 가장 먼저 자동으로 실행된다.
% 메인 코드에서 clear all 하면 pkg는 무효화되고 default param은 유지된다.

clc; clear all; close all; 
addpath(genpath(pwd));

pkg load io
pkg load signal

fontsize = 16;

% Position
screenSize = get(0, 'ScreenSize'); % [x y width height]
screenWidth = screenSize(3);
screenHeight = screenSize(4);
windowWidth = floor(screenWidth / 3);
windowHeight = floor(screenHeight / 3);
left = (screenWidth - windowWidth) / 2;
bottom = (screenHeight - windowHeight) / 2;
position = [left, bottom, windowWidth, windowHeight];

% figure
set(0, "defaultFigurePosition", position);
set(0, "defaultFigureName", "Figure");
# set(0, "defaultFigureColor", "#FFFFFF");
# set(0, "defaultFigureNumberTitle", "off");

% axes
set(0, "defaultAxesFontSize", fontsize);
set(0, "defaultAxesLineWidth", 0.5);
set(0, "defaultAxesXGrid", "on");
set(0, "defaultAxesYGrid", "on");
set(0, "defaultAxesZGrid", "on");
set(0, "defaultAxesNextPlot", "add");
# set(0, "defaultAxesColorOrder", color_base);

% plot
# set(0, "defaultLineLineWidth", 1.2);

% text
set(0, "defaultTextFontSize", fontsize);

코드 해설

목적

Signal Processing + Visualization 중심의 Octave 학습 예제

입력

  • 스크립트 상단에서 정의한 파라미터/입력 데이터를 사용합니다.

출력

  • 그래프/figure 출력

실행 흐름

  1. plot

핵심 함수/주제

setfloorscreenSizeaddpathgenpathget

실습 과제

  • 샘플링 주파수나 입력 주파수를 바꿔 스펙트럼 변화를 비교해보세요.
  • 축 범위와 라벨을 바꿔 그래프 해석성이 어떻게 달라지는지 확인해보세요.
  • 핵심 함수 set의 인자를 한 가지 바꿔 결과 변화를 기록해보세요.

학습 팁

  • 그래프 비교 시 축 범위(XLim/YLim)와 단위를 먼저 고정하면 해석 오류를 줄일 수 있습니다.
  • 입력 파일 경로가 현재 작업 디렉터리 기준인지 먼저 확인하세요.