How to match the matrix dimension ?

조회 수: 1 (최근 30일)
manish kumar
manish kumar 2019년 2월 19일
답변: KSSV 2019년 2월 19일
clc
clear all
close all
load ('C:\Users\manish\Downloads\100ml.mat')
val=val';
plot(val)
I=val((1:end),1);
str1=dec2bin(typecast(int8(I),'uint8'));
ecg_signal_I=filtering(I);
c1=dec2bin(typecast(int8(ecg_signal_I),'uint8'));
figure
title('I')
plot(ecg_signal_I)
ylim([-1000 1000])
sampling_frequency = 360;
mains_coeff = 0.1; % Amplitude of mains line to change. Depends on your ECG signal.
time_step = 1/sampling_frequency;
max_time = 2; % Duration of your signal in seconds.
t = time_step:time_step:max_time; % This is our time vector.
mains_signal = cos(2*pi*110*t); % 110Hz mains frequency. Depends.
dirty_signal = val' + mains_coeff*mains_signal;
plot(dirty_signal);
I am getting error in second last line of the above code: Matrix dimensions must agree.
Error in c100ml2 (line 21)
dirty_signal = val' + mains_coeff*mains_signal;
  댓글 수: 2
James Tursa
James Tursa 2019년 2월 19일
What are the dimensions of the variables that cause the error?
manish kumar
manish kumar 2019년 2월 19일
"Val" are of 3600*1 double and "Main_signal" are of 1*720 .

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

답변 (1개)

KSSV
KSSV 2019년 2월 19일
Val" are of 3600*1 double and "Main_signal" are of 1*720
How do you expect them to add? YOu need to do interpolation and get them to the same dimensions. Read about interp1

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by