2

I have to create an array from the outputs of a for loop. For example, if the for loop was:

for i=[0.01, 0.02, 0.05]
    exp(i)
end

I should create an array such as

[exp(0.01) exp(0.02) exp(0.03)]

How can I do that? Thanks.

1 Answer 1

4

Almost like you did :-)

V= [0.1 0.2 0.3]
R=exp(V)

Create a vector of values for which you want to compute a function and pass it as parameter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.