I need help writing equation in matlab
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1273315/image.png)
how do i write this equation in a matlab script
0 comentarios
Respuestas (2)
Image Analyst
el 24 de En. de 2023
This looks like a homework problem. If you have any questions ask your instructor or read the link below to get started:
Obviously we can't give you the full solution because you're not allowed to turn in our code as your own.
Some hints to get you started:
n = 5;
v = 1 : n
denom = 1 ./ v
x = 3;
num = x .^ v
To learn other fundamental concepts, invest 2 hours of your time here:
2 comentarios
Image Analyst
el 25 de En. de 2023
Here is it in more steps than needed just to show you each step involved.
% Call the function with x=10 and n=5
output = e(10, 5)
%-------------------------------------------------------------------
% function definition:
function output = e(x, numberOfTerms)
v = 0 : numberOfTerms
denom = factorial(v)
denom = 1 ./ denom
numerator = x .^ v
output = numerator ./ denom
output = sum(output)
end
Walter Roberson
el 25 de En. de 2023
format long g
syms x n m
result = symsum(x^n/factorial(n), n, 0, m)
limit(result, m, inf)
result20 = subs(result, m, 20)
exp20 = subs(result20, x, sym(pi))
exp20_numeric = double(exp20)
exact = exp(sym(pi))
exact_numeric = double(exact)
exact_numeric - exp20_numeric
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!