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

Respuestas (3)

Star Strider
Star Strider el 11 de Mayo de 2017

0 votos

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 el 11 de Mayo de 2017

0 votos

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

1 comentario

Matt J
Matt J el 11 de Mayo de 2017
you should also pre-allocate y
x=[-5:0.2:5];
k=numel(x);
y=nan(1,k);
...

Iniciar sesión para comentar.

Jan
Jan el 11 de Mayo de 2017

0 votos

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.

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 11 de Mayo de 2017

Comentada:

el 11 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by