Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to find the range in the form of (a, b) of this function?

Asked by Michael on 9 Jun 2013

The range of f = (7*x +sin(x))/(x^2 + x + 2) is of the form [a,b]. Give a and b correct to two decimal places

edit - Not a homework question. Its a Test question for revision, has me stumped

so far, I have this

clear all 
syms x
hold on 
fplot(@fun2, [-6 6]);
hold off
x1 = fminbnd(@fun2, -6, 6);
y1 = fun2(x1)
y1 = sprintf('%0.2f',y1);
x2 = fminbnd(@fun2_neq, -6,6);
y2 = fun2_neq(x2)
y2 = sprintf('%0.2f',y2)

But wouldn't I need to specify fun2_neq and fun2 in different mfiles? Also, what would I specify it as?

1 Comment

per isakson on 9 Jun 2013

Homework? If so, what have you done so far?

Michael

Products

No products are associated with this question.

1 Answer

Answer by Image Analyst on 9 Jun 2013
Accepted answer

You're missing a parenthesis. Is the 7*x over the quadratic, or just the sin is over the quadratic? Please fix the parentheses, then plot over -100 to 100 or something and see the shape of the curve. Make sure you use ./ instead of / and .^ instead of ^ and then you can do it without a loop, in just 3 lines of code (like I did). (Actually the range is the same no matter where you put the missing parenthesis.)

2 Comments

Image Analyst on 9 Jun 2013

Regarding your clarification, is there a range of x specified? Otherwise you can just look at the formula, see where the denominator goes to zero, and immediately know the range. And you won't need 2 decimal places to specify it.

Michael on 9 Jun 2013

Yes I guess that would be appropriate, yet the matlab code to back it up would be missing so it'd most likely not work out as easily as you say.

Image Analyst

Contact us