can someone help me determine what's wrong with my code?

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 3일
편집: madhan ravi 2018년 11월 3일
f=@(x) (x.^3-3.*x.^2-4.*x+12)./(x-2) ; % Insert function f here
g=@(x) (x.^2-4.*x)./abs(x-4) ; % Insert function g here
x=[1.5:0.01:2.5]; % Refer to Step 2 above for the next 3 lines
y1=f(x);
figure
fp=plot(x,y1);
title('Graph of f'); % DO NOT CHANGE COMMAND ON THIS LINE figure; % DO NOT CHANGE COMMAND ON THIS LINE
x=[3.5:0.01:4.5]; % Refer to Step 4 above for the next 3 lines
figure
y2=g(x);
gp=plot(x,y2);
title('Graph of g'); % DO NOT CHANGE COMMAND ON THIS LINE

댓글 수: 10

how do i do that? i'm new to this..
madhan ravi
madhan ravi 2018년 11월 3일
편집: madhan ravi 2018년 11월 3일
Whats your error message , everything should be fine ? Copy your code and paste it here we can’t test your image
f=@(x) (x.^3-3*x.^2-4*x+12)/(x-2) ; % Insert function f here g=@(x) (x.^2-4*x)/abs(x-4) ; % Insert function g here x=[1.5:0.01:2.5]; % Refer to Step 2 above for the next 3 lines y1=x; fp=plot(x,y1); title('Graph of f'); % DO NOT CHANGE COMMAND ON THIS LINE figure; % DO NOT CHANGE COMMAND ON THIS LINE x=[3.5:0.01:4.5]; % Refer to Step 4 above for the next 3 lines y2=x; gp=plot(x,y2); title('Graph of g'); % DO NOT CHANGE COMMAND ON THIS LINE
use .* and ./ instead of * and /
see edited answer
madhan ravi
madhan ravi 2018년 11월 3일
편집: madhan ravi 2018년 11월 3일
did it work out? If it did make sure to accept the answer so that people know the question is solved else let know
I tried that but it still says that the code isn't right.
oh never mind it worked!! thanks alot!!
Anytime!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

질문:

2018년 11월 3일

댓글:

2018년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by