How to match the matrix dimension ?

2 次查看(过去 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

Community Treasure Hunt

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

Start Hunting!

Translated by