Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have this line of code
x = [1 2];
n = 3;
fx = zeros(1,n);
for i = 0:n
fx(:,i+1) = (((-1)^i).*(x.^(2*i+1)))/(factorial(2*i+1));
end
fx = sum(f
x);
im trying to get a vector as my result for my input x values but i keep getting an error message. i don't know how to fix it pls help
0 commentaires
Réponses (1)
David Hill
le 20 Sep 2020
Not sure what sum you are after
x = [1 2];
n = 3;
fx = zeros(n+1,size(x,2));
for i = 0:n
fx(i+1,:) = (((-1)^i)*(x.^(2*i+1)))/(factorial(2*i+1));
end
fx1 = sum(fx);
fx2 = sum(fx,2);
0 commentaires
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!