Can someone help me with this assignment?

i'm using MatLab grader

2 comentarios

Rik
Rik el 10 de Nov. de 2018
Have a read here (or here for more general advice) and here. It will greatly improve your chances of getting an answer. You can find guidelines for posting homework on this forum here.
Maryam AlKhoury
Maryam AlKhoury el 10 de Nov. de 2018
Editada: madhan ravi el 10 de Nov. de 2018
fa=@(x) (2.*x.^3+3.*x.^2-6.*x+19)./(7.*x.^3-20.*x-5); % define the function for part (a)-REMEMBER to use element-by-element operations (.* ./ .^)
x=[-10 -100 -1000 -10000 -100000 -1000000 -10000000]; % define the vector x
ya=f(x) % calculate f(x) (No semicolon to see output)
syms x; % DO NOT CHANGE CODE ON THIS LINE
aLimit=limit( ) % No semicolon
% Repeat the above process for part (b)
fb=@(x) sqrt(4.*x.^2+7.*x+1)-2.*x;
x=[10 100 1000 10000 100000 1000000 10000000];
yb=f(x)
syms x;
bLimit=limit( )
this is my code... i dont know how to choose the values of x and what to write in "ya= "

Iniciar sesión para comentar.

 Respuesta aceptada

madhan ravi
madhan ravi el 10 de Nov. de 2018
Editada: madhan ravi el 17 de Nov. de 2018
fa=@(x) (2.*x.^3+3.*x.^2-6.*x+19)./(7.*x.^3-20.*x-5); % define the function for part (a)-REMEMBER to use element-by-element operations (.* ./ .^)
x=[-10 -100 -1000 -10000 -100000 -1000000 -10000000]; % define the vector x
ya=fa(x) % calculate f(x) (No semicolon to see output)
syms x; % DO NOT CHANGE CODE ON THIS LINE
aLimit=limit((2.*x.^3+3.*x.^2-6.*x+19)./(7.*x.^3-20.*x-5),x,-inf ) % No semicolon
% Repeat the above process for part (b)
fb=@(x) sqrt(4.*x.^2+7.*x+1)-2.*x;
x=[10 100 1000 10000 100000 1000000 10000000];
yb=fb(x)
syms x;
bLimit=limit( sqrt(4.*x.^2+7.*x+1)-2.*x,x,inf)
command window:
>> COMMUNITY
ya =
0.2382 0.2814 0.2853 0.2857 0.2857 0.2857 0.2857
aLimit =
2/7
yb =
1.7025 1.7449 1.7495 1.7499 1.7500 1.7500 1.7500
bLimit =
7/4
>>

22 comentarios

madhan ravi
madhan ravi el 10 de Nov. de 2018
Read about limit() it's not that difficult to imply in MATLAB
Rik
Rik el 10 de Nov. de 2018
@Madhan, congratulations for reaching the 2k rep level, especially in such a short time.
madhan ravi
madhan ravi el 10 de Nov. de 2018
@Rik thank you very much :)
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
it says that there's an error at line 3 ya=f(x)
Try
clear all %at the very beginning
and try again
I got the result!
madhan ravi
madhan ravi el 17 de Nov. de 2018
see edited answer
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
i tried that but i still get the same error
madhan ravi
madhan ravi el 17 de Nov. de 2018
Editada: madhan ravi el 17 de Nov. de 2018
upload the code that you are trying , did you try my answer ?
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
i tried substituting values for ya and yb and this is what i got
madhan ravi
madhan ravi el 17 de Nov. de 2018
i edited my answer please try again
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
i got the same answer as you but for some reason i got this error:
madhan ravi
madhan ravi el 17 de Nov. de 2018
please upload the code that you are trying becausse you should be getting any error
fa=@(x) (2.*x.^3+3.*x.^2-6.*x+19)./(7.*x.^3-20.*x-5) ; % define the function for part (a)-REMEMBER to use element-by-element operations (.* ./ .^)
x=[-10 -100 -1000 -10000 -100000 -1000000 -10000000]; % define the vector x
ya=fa(x) % calculate f(x) (No semicolon to see output)
syms x; % DO NOT CHANGE CODE ON THIS LINE
aLimit=limit((2.*x.^3+3.*x.^2-6.*x+19)./(7.*x.^3-20.*x-5),x,-inf) % No semicolon
% Repeat the above process for part (b)
fb=@(x) sqrt(4.*x.^2+7.*x+1)-2.*x;
x=[10 100 1000 10000 100000 1000000 10000000];
yb=fb(x)
syms x;
bLimit=limit(sqrt(4.*x.^2+7.*x+1)-2.*x,x,inf)
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
and this is my output:
ya =
0.2382 0.2814 0.2853 0.2857 0.2857
aLimit =
2/7
yb =
1.7025 1.7449 1.7495 1.7499 1.7500
bLimit =
7/4
madhan ravi
madhan ravi el 17 de Nov. de 2018
Editada: madhan ravi el 17 de Nov. de 2018
This is my output when i tried your answer , your getting error because you should be getting 7 elements but instead your are getting 5
>> COMMUNITY
ya =
0.2382 0.2814 0.2853 0.2857 0.2857 0.2857 0.2857
aLimit =
2/7
yb =
1.7025 1.7449 1.7495 1.7499 1.7500 1.7500 1.7500
bLimit =
7/4
>>
or try
format longg
at the very beginning of your code
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
this is my output (7 elements) but i still get an error:
ya =
0.2382 0.2814 0.2853 0.2857 0.2857 0.2857 0.2857
aLimit =
2/7
yb =
1.7025 1.7449 1.7495 1.7499 1.7500 1.7500 1.7500
bLimit =
7/4
madhan ravi
madhan ravi el 17 de Nov. de 2018
You have met all the requirements but why is it showing an error?
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
yeah i dont know
madhan ravi
madhan ravi el 17 de Nov. de 2018
Better ask your teacher maybe he has set an unique algorithm ?
Maryam AlKhoury
Maryam AlKhoury el 17 de Nov. de 2018
yeah okay.. thanks anyways for your help
madhan ravi
madhan ravi el 17 de Nov. de 2018
Glad could help upto a certain , not satisfied though

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Mobile Fundamentals en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 10 de Nov. de 2018

Comentada:

el 17 de Nov. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by