I do not know how to create this complicated SUM equation within MATLAB for multiple variables?
Afficher commentaires plus anciens
I have to store a data table in MATLAB, and then run them through a complicated equation, which can both be seen in the attached files as examples. However, I do not know how to store those values, or write that equation, or call those values and run the equation. I really could use some help here...
4 commentaires
Zachary
le 11 Oct 2024
Stephen23
le 11 Oct 2024
When A=6 why does B only go up to 6?


Well, it isn't consistent with the formula which says the outer sum goes through B+1 so if B==6, B+1-->7. Unless B is supposed to have been 5, instead? Who knows, all we can see is what is posted; no idea from whence this all came, but I'd guess the table's simply wrong...now whether it was intended to have B==6 and they didn't add the extra row, or they have as many terms as they wanted and just entered the wrong number for B is indeterminate.
As for the code; you've coded up the individual terms, but not the sums...
I was having trouble reading/deciphering the equation, I didn't recognize the e was/is the Euler function; I thought it was the exponential and then sub- and superscripts were most confusing...
Réponses (1)
Dr W Kurt
le 14 Oct 2024
0 votes
B = [B1, B6]; % Array for B values
w = [w1, w6]; % Array for w values
lambda = ...; % Define lambda (if not already defined)
t = ...; % Define t (if not already defined)
% Preallocate arrays for results
SmallSum = zeros(1, 2);
BigSum = zeros(1, 2);
% Loop through both sets of B and w
for i = 1:2
SmallSum(i) = (B(i) * lambda) ./ ((w(i) + lambda).^2);
BigSum(i) = euler(w(i), t) ./ SmallSum(i);
end
% Plot both results
plot(BigSum(1)); % Plot for BigSum1
hold on;
plot(BigSum(2)); % Plot for BigSum6
hold off;
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!