I do not know how to create this complicated SUM equation within MATLAB for multiple variables?

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

What I was thinking so far is this:
A=[1,6];
B1=[1,2];
B6=[1,2,3,4,5,6];
wi1=[0,10];
wi6=[0,10,11,12,13,14];
Bi1=[0.1,0.9];
Bi6=[0.1,0.2,0.3,0.4,0.5,0.6];
But as to the actual equation, and how to run it through, I am lost. I have a feeling that a loop or two is involved, but I do not know how to apply that at all.
When A=6 why does B only go up to 6?
It's just how the value is "defined", I guess. Here is what I was thinking so far:
SmallSum1 = (B1*lambda)./((w1+lambda).^2);
BigSum1 = (euler(w1,t))./SmallSum1;
SmallSum6 = (B6*lambda)./((w6+lambda).^2);
BigSum6 = (euler(w6,t))./SmallSum6;
plot(BigSum1);
plot(BigSum6);
I separated the equation into the smaller sum (in the denominator) and the overall sum, then calling the smaller sum into the larger one. However, that just generates a whole slew of errors.
dpb
dpb le 12 Oct 2024
Modifié(e) : dpb le 12 Oct 2024
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...

Connectez-vous pour commenter.

Réponses (1)

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

Produits

Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by