Running a calculation for an entire array and putting the results into a new array
45 次查看(过去 30 天)
显示 更早的评论
Hello
I am trying to write code to run a calculation using the values in an array and storing them in a new array.
For example:
I have the array A, that has 194 values.
I want to use a calculation like: 2+2/n = c, with n being the number in the array and to store the answer, c, in array B.
I code use some help on the code, I don't know if it needs a for loop.
Thanks
0 个评论
采纳的回答
Erivelton Gualter
2019-11-20
编辑:Erivelton Gualter
2019-11-20
% Given A as:
A = 1:194;
% We can simply solve the following:
B = 2+2./A;
2 个评论
Owen Brady
2023-4-21
How would I do an equation where the array is angles and must be in a cos and sin function?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!