1

I have a function:

f=@(x) 1-(sin(x)/x);

and when I put in my array h with 12 items in the array (.1 .01 .001 ... .000000000001) it comes out with just 1 number.

Any help on how to get my f to go through every item in my h would be helpful.

Here is a snipped image of everything I have

enter image description here

0

1 Answer 1

4

Element-Wise Operations

This is a case where scalar/elemental operations occur. Using . will apply the function to all the elements

• "./" -> Division over all elements in array

• ".*" -> Multiplication over all elements in array

f = @(x) 1-(sin(x)./x);

Results = f(h);

Ran using MATLAB R2019b

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

1 Comment

Thank you very much.... figured it was something simple I had overlooked

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.