Programming a summation equation

2 views (last 30 days)
hamzah khan
hamzah khan on 23 Jul 2020
Answered: Alan Stevens on 24 Jul 2020
I am trying to program this instance
This is my Fourier_Force
using this code:
Z =3;
r = 2;
for j =1:1:size(Fourier_Force,1)
for q = 0:1:Z-1
Fourier_Force{j,1} = Fourier_Force{j,1} .* exp(-j*q*((2*pi)/3)*r) % Fourier_force has two values(x and y), thats why I used ".*"
Fourier_Force{j,1} = Fourier_Force{j,1} +Fourier_Force{j,1}
But it is not giving correct results, I am having problems in the loop and the summation part.
Does anybody know?

Answers (1)

Alan Stevens
Alan Stevens on 24 Jul 2020
Looks like you are trying to use j as both a loop counter and as sqrt(-1). I assume the latter is what is needed in the exponential function. If so, use i instead.

Community Treasure Hunt

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

Start Hunting!

Translated by