i'm using MatLab grader

댓글 수: 2

Rik
Rik 2018년 11월 10일
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 2018년 11월 10일
편집: madhan ravi 2018년 11월 10일
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= "

댓글을 달려면 로그인하십시오.

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 10일
편집: madhan ravi 2018년 11월 17일

0 개 추천

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

madhan ravi
madhan ravi 2018년 11월 10일
Read about limit() it's not that difficult to imply in MATLAB
Rik
Rik 2018년 11월 10일
@Madhan, congratulations for reaching the 2k rep level, especially in such a short time.
madhan ravi
madhan ravi 2018년 11월 10일
@Rik thank you very much :)
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
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 2018년 11월 17일
see edited answer
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
i tried that but i still get the same error
madhan ravi
madhan ravi 2018년 11월 17일
편집: madhan ravi 2018년 11월 17일
upload the code that you are trying , did you try my answer ?
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
i tried substituting values for ya and yb and this is what i got
madhan ravi
madhan ravi 2018년 11월 17일
i edited my answer please try again
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
i got the same answer as you but for some reason i got this error:
madhan ravi
madhan ravi 2018년 11월 17일
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 2018년 11월 17일
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 2018년 11월 17일
편집: madhan ravi 2018년 11월 17일
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 2018년 11월 17일
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 2018년 11월 17일
You have met all the requirements but why is it showing an error?
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
yeah i dont know
madhan ravi
madhan ravi 2018년 11월 17일
Better ask your teacher maybe he has set an unique algorithm ?
Maryam AlKhoury
Maryam AlKhoury 2018년 11월 17일
yeah okay.. thanks anyways for your help
madhan ravi
madhan ravi 2018년 11월 17일
Glad could help upto a certain , not satisfied though

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Mobile Fundamentals에 대해 자세히 알아보기

태그

질문:

2018년 11월 10일

댓글:

2018년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by