필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

i am a newb on matlab. why i've got some error with this. please help me

조회 수: 1 (최근 30일)
Mutia Rahmadini
Mutia Rahmadini 2021년 10월 3일
마감: Sabin 2023년 9월 29일
clear all; clc
[x,s] = xlsread("nilaifreq.csv");
freq_list = freq_list >= 0.04 & freq_list < 0.15;
% sum all power value with freq. range from LF criteria
lf_data = pow_list(freq_list >= 0.04 & freq_list < 0.15);
sum_lf_data = sum(lf_data);
C = [C char(10) 'sum all power value with freq, range from 0.04 to 0.15 for LF criteria...'];
% sum all power value with freq. range from HF criteria
hf_data = pow_list(freq_list >= 0.15 & freq_list <= 0.4);
sum_hf_data = sum(hf_data);
C = [C char(10) 'sum all power value with freq, range from 0.15 to 0.4 for LF criteria...'];
% ratio LF/HF
ratio_lf_hf = sum_lf_data / sum_hf_data;
C = [C char(10) 'ratio LF/HF...'];
please help me, i want to sum the data power just include in frequency 0.04 to 0.15. i write the code, but got error.
  댓글 수: 2
DGM
DGM 2021년 10월 3일
You'll have to mention what error you're actually getting.
% placeholder data
freq_list = rand(10,1)/2;
pow_list = (1:10).';
C = [];
% all this does is convert freq_list to a logical vector
% which breaks everything
%freq_list = freq_list >= 0.04 & freq_list < 0.15; % don't need this
% sum all power value with freq. range from LF criteria
lf_data = pow_list(freq_list >= 0.04 & freq_list < 0.15);
sum_lf_data = sum(lf_data);
C = [C char(10) 'sum all power value with freq, range from 0.04 to 0.15 for LF criteria...'];
% sum all power value with freq. range from HF criteria
hf_data = pow_list(freq_list >= 0.15 & freq_list <= 0.4);
sum_hf_data = sum(hf_data);
C = [C char(10) 'sum all power value with freq, range from 0.15 to 0.4 for HF criteria...'];
% ratio LF/HF
ratio_lf_hf = sum_lf_data / sum_hf_data;
C = [C char(10) 'ratio LF/HF...'];
Idk if there's some problem with how the file is imported or something, but this runs.
Cris LaPierre
Cris LaPierre 2021년 10월 3일
Use the paperclip icon to attach your csv file to your post.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by