With what code can I make Matlab do this operation automatically
显示 更早的评论
Good morning.
I hope you can help me.
How can I enter the elements of a vectror automatically in the formula, to obtain the value of E and then introduce the elements of the next vector. Everything automatically.
____________________________
clc; clear; close all
x1=[1 2 3 4 5 6 7 8 9 10]
x2=[2 4 6 8 1 3 5 2 3 1]
x3=[2 1 4 2 6 4 8 3 8 3]
E=exp(x1(1))+exp(x1(2))+exp(x1(3))+exp(x1(4))+exp(x1(5))+exp(x1(6))+exp(x1(7))+exp(x1(8))+exp(x1(9))+exp(x1(10))
__________________________________________________________________________________________________
Regards
3 个评论
clc; clear; close all
x1=[1 2 3 4 5 6 7 8 9 10];
x2=[2 4 6 8 1 3 5 2 3 1];
x3=[2 1 4 2 6 4 8 3 8 3];
% your function
E=exp(x1(1))+exp(x1(2))+exp(x1(3))+exp(x1(4))+...
exp(x1(5))+exp(x1(6))+exp(x1(7))+exp(x1(8))+exp(x1(9))+exp(x1(10))
eks = @(x) sum(exp(x));
E1 = eks(x1)
Ricardo Gutierrez
2018-1-23
Ricardo Gutierrez
2018-1-24
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Array Geometries and Analysis 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!