필터 지우기
필터 지우기

Help me to fill the gap of the data points using linear interpolation.

조회 수: 7 (최근 30일)
NANDEESWARAN
NANDEESWARAN 2023년 9월 25일
편집: Voss 2023년 9월 25일
clear,clc,close all
fname = 'RLC_Step_Underdamped_b.csv';
Data = importdata(fname,',',15);
Fs = 25000;
time = Data.data(:,1)/Fs;
voltage = Data.data(:,3);
time_copy = time;
voltage_copy = voltage;
gap = find(isnan(voltage_copy));
gap_time = time(gap);
time_copy = [];
voltage_copy = [];
gap_voltage_linear = interp1(time_copy,voltage_copy,gap_time,'linear')
plot(time,voltage,'k',gap_time,gap_voltage_linear,'r',gap_time,gap_voltage_spline,'b','LineWidth',2)
xlabel('time(s)')
ylabel('Voltage(V)')
title('Step response of an underdamped RLC Circuit')
legend('Original dat with gaps','Linear Interpolation','Spline interpolation')

채택된 답변

Voss
Voss 2023년 9월 25일
clear,clc,close all
fname = 'RLC_Step_Underdamped_b.csv';
Data = importdata(fname,',',15);
Fs = 25000;
time = Data.data(:,1)/Fs;
voltage = Data.data(:,3);
voltage_linear = fillmissing(voltage,'linear');
voltage_spline = fillmissing(voltage,'spline');
plot(time,voltage,'k',time,voltage_linear,'--r',time,voltage_spline,'--b','LineWidth',2)
xlabel('time(s)')
ylabel('Voltage(V)')
title('Step response of an underdamped RLC Circuit')
legend('Original dat with gaps','Linear Interpolation','Spline interpolation')
  댓글 수: 2
Voss
Voss 2023년 9월 25일
편집: Voss 2023년 9월 25일
You're welcome! Any questions, let me know.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Circuits and Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by