How to match the matrix dimension ?

1 Ansicht (letzte 30 Tage)
manish kumar
manish kumar am 19 Feb. 2019
Beantwortet: KSSV am 19 Feb. 2019
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 Kommentare
James Tursa
James Tursa am 19 Feb. 2019
What are the dimensions of the variables that cause the error?
manish kumar
manish kumar am 19 Feb. 2019
"Val" are of 3600*1 double and "Main_signal" are of 1*720 .

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 19 Feb. 2019
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