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 Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by