Octave Atelier

코드와 해설을 함께 읽는 학습 문서

Code Detail

power_sum

Core Octave 중심의 Octave 학습 예제

mylib/inst/power_sum.m

목록으로

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

카테고리

mylib Utilities

library

코드 길이

8

lines

작성자

-

날짜 정보 없음

패키지

none

pkg load

함수 시그니처

function out = power_sum(in)

전체 코드

8 lines

function out = power_sum(in)
    # in: 1D array (time series or spectral density function)
    # out: power sum
    nn = length(in);
    out = sum(conj(in) .* (in)) / nn;
    out = real(out);
end

코드 해설

목적

  • Core Octave 중심의 Octave 학습 예제

입력

  • 파라미터: in

출력

  • 반환값: out

실행 흐름

  1. 코드 상단부터 순차 실행

핵심 함수

  • array
  • conj
  • length
  • real
  • sum

실습 과제

  • 핵심 함수 array의 인자를 한 가지 바꿔 결과 변화를 기록해보세요.

같은 카테고리 코드

이전 코드 my_var 다음 코드 read_close_price