[-5:0.2:5]
k=max(size(x));
for i=1:k
if ((x(i)>=-5)&(x(i)<1))
y(i)=atan(x(i)+1)+(x(i)-10.04)^7+(10.04-7)^(1/5)+3^(x(i)+2)+sin(2*x(i)-10.04)-tan(2*x(i)-6);
end
if ((x(i)>=1)&(x(i)<=-5))
y(i)=acot(x(i)+10.04)+(x(i))^9+5^(x(i)+8)+(10.04+2)^(1/6)-log((x(i)+2))^4-cos(5*10.04-4);
end
end
WHY I CANT using PLOT ????
Please, i really need help for homework for tomorrow and i HAVE 15 PROBLEMs and i have no idea how to do these
Can someone help me with all of these ? Plese contact me

답변 (3개)

Star Strider
Star Strider 2017년 5월 11일

0 개 추천

One reason is that you have not called the plot function in the code you have posted. We cannot tell if you are calling it correctly. (However, if you need our permission to use plot, you have it!)
Also this line:
[-5:0.2:5]
is just sitting in your code with nothing to do. What do you want it to do?
I understand your desperation, since I suspect most if not all of us here have been in your situation at least once. Please take a deep breath and explain your problem in sufficient detail that we can understand it and help you solve it.
Matt J
Matt J 2017년 5월 11일

0 개 추천

Hint: Your mistake is somewhere in here
((x(i)>=1)&(x(i)<=-5))

댓글 수: 1

you should also pre-allocate y
x=[-5:0.2:5];
k=numel(x);
y=nan(1,k);
...

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

Jan
Jan 2017년 5월 11일

0 개 추천

The first line [-5:0.2:5] creates a vector but as long as it is not assigned, it is lost. Perhaps you mean x = -5:0.2:5; ? See avoid unnecessary square brackets
If you state, that you "cannot use plot", please share the information with us: There is no plot command in the posted code. Therefore I cannot guess, what happens on your computer. But if you are really in a hurry, it is your interest to explain the actual problem.

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

질문:

2017년 5월 11일

댓글:

2017년 5월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by