How do I make a summation equation in MATLAB?

조회 수: 9 (최근 30일)
Brooke
Brooke 2023년 2월 14일
편집: Sai 2023년 2월 21일
The equation I'm trying to get is the response equation but for the life of me I cannot figure out what I'm supposed to do to type it out. Here is my code:
t = time;%time for both
T = noisy;%frequency of the first signal
Ts = clean;%frequency of the second signal
h = h;%sampling interval
N = length(clean);%length of impulse response
x = integral(h(T)*x(t-T),T,-inf,inf);%first signal
y = ;%second signal
convolution = conv(x,y) %convolution of both the signals x & y
figure;%making the plots
subplot(2,2,1);%plot for the noisy spike train
plot(t,noisy);
title('Time vs. Noisy Spike train');
xlabel('time');
ylabel('spike train');
yline(y,r,resting);
yline(y,g,threshold);
yline(y,b,peak membrane potential);
subplot(2,2,2);%plot for the clean spike train
plot(t,clean);
title('Time vs. Clean Spike train');
xlabel('time');
ylabel('spike train');
yline(y,r,resting);
yline(y,g,threshold);
yline(y,b,peak membrane potential);
subplot(2,2,3);%plot for the clean spike train
plot(t,clean);
title("Time vs. Conv'd Spike train");
xlabel('time');
ylabel("conv'd spike train");
And here is the question i'm trying to answer:
I must just not be ansking the right questions when serching for how to write out that y(nTs) equation because I've only ended up confusing myself further on what to do. (Also I think I have everything needed to make the plots cprrectly
Please help.
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 2월 14일
you should not be convolving the integral with the second equation. You should be convolving the function and the samples from the mat file
Brooke
Brooke 2023년 2월 14일
Oh ok, So now that I've tried that I'm getting an error for:
"Array indices must be positive integers or logical values.
Error in MATLAB_project1_real (line 6)
x = integral(h(T)*x(t-T),T,-inf,inf);%first signal"
and I don't know what to do here...

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

답변 (1개)

Sai
Sai 2023년 2월 21일
편집: Sai 2023년 2월 21일
Hi,
I understand that you are unable to use summation equation in MATLAB and need some assistance in applying convolution to the signals.
From my understanding, the corresponding file ‘apfilter.mat’ contains four columns/vectors.
They are:
  1. Artifact – free: ‘clean’ - x
  2. Noise: ‘noisy’ - y
  3. Impulse response: ‘h’ - ‘h’
  4. Time: ‘time’ - time’
Many questions that only need plotting the signals or vectors are rather simple. It can be done using plot command.
plot(clean,time)
plot(noisy,time)
The convolution must be applied between either ‘clean’ or ‘noisy’ with impulse response ‘h’.
Please refer to the conv documentation for doing convolution.
Now again the resultant vectors are plotted using plot.
plot(conv(clean,h),time).
All the labelling can be followed as in your code.
There is no need of using summation.
For future reference, please refer to the summation documentation for using summation – discrete integral.
Regards,
G. Saikumar,
MathWorks Technical Support

카테고리

Help CenterFile Exchange에서 Signal Generation and Preprocessing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by