How do I make a summation equation in MATLAB?

3 vues (au cours des 30 derniers jours)
Brooke
Brooke le 14 Fév 2023
Modifié(e) : Sai le 21 Fév 2023
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 commentaires
Walter Roberson
Walter Roberson le 14 Fév 2023
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 le 14 Fév 2023
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...

Connectez-vous pour commenter.

Réponses (1)

Sai
Sai le 21 Fév 2023
Modifié(e) : Sai le 21 Fév 2023
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

Catégories

En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by