Homework for tomorrow please

[-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 件のコメント

Matt J
Matt J 2017 年 5 月 11 日
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 ExchangeStartup and Shutdown についてさらに検索

タグ

タグが未入力です。

質問済み:

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