Question

in matlab

Write and test a function double(x) which doubles its input argument, i.e., the statement x-double (x) should double the value in x.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code :

function x= double(x) //function name is double and input parameter is x and output variable name is also x
x=x+x; stroing added value to x
end

function calling:

val=2.0 //creating variable val
double(val) and caling double function with this value as parameter

output:

ans=4.0

the compilation and execution will happen eventhough input variable name and output variable name is same:

e Computer Sc x-A Declare funct × / く/> Online Octeve ×く◆ MATLAB Func × \く/> Online Octeve × . Var able name × KCSecure https

Add a comment
Know the answer?
Add Answer to:
in matlab Write and test a function double(x) which doubles its input argument, i.e., the statement...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT