How should I approach writing a MATLAB function evaluating a conditional logarithmic function with a variable number of arguments?
-
Write a Matlab function call_functions to evaluate the function f(x,y)=ln(1/1-x)*ln(1/1-y). Note that call_function will have two input arguments x and y and this function will call f_x [which equals ln(1/1-x)] function twice to evaluate f(x,y). From the command window test your program for x=0.5, y=0.5 and x=1, y=0.5. For #3 use the script for number 2. function if [f_xy]=-999999; else [f_xy]=log((1-x)^(-1))*log((1-y)^(-1)); end If anyone could help understand how to approach this it would really help! Thanks. And would I am vague on commands such as feval, eval, and nargin. And vague on applying subfunctions and nested functions. Any approach would help. Please explain in laymens terms.
-
Answer:
First, learn to use .* ./ .^ There is nothing telling you that your input will be scalars and not vectors or matrices. This assignment calls for using subfunctions. At the end of your function you should add function f=f_x(z) f=log(1./(1-z)); end Then you should call it in your formula like this: f_xy=f_x(x).*f_x(y); ...
Achilleas Vortselas at Quora Visit the source
Related Q & A:
- How do I scroll to a certain widget in a QScrollArea?Best solution by Stack Overflow
- How can I apply for a tax identification number in the Philippines?Best solution by Yahoo! Answers
- How can I get into a graduate program without a stellar GPA?Best solution by answers.yahoo.com
- How should I dress for a volunteer interview at a hospital?Best solution by ehow.com
- How do I ask for a certain salary at a job interview?Best solution by Quora
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.