Can someone help me with this assignment?

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)
madhan ravi
madhan ravi 2018 年 11 月 17 日
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
Maryam AlKhoury
Maryam AlKhoury 2018 年 11 月 17 日
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
>>
madhan ravi
madhan ravi 2018 年 11 月 17 日
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 ExchangeMATLAB Mobile Fundamentals についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by