Hi there, so say I have 2 functions,
x1 = linspace(0, pi/2);
y1 = sin(x1);
x2 = linspace(pi/2, (pi/2)+1);
y2 = pi/2 + 1 -x2;
plot(x1, y1, x2, y2)
plot(x1, y1, x2, y2)
Problem with this is that that these are 2 separate functions on 1 graph. I need for both of them to be combined so that I can make a y function equal to both of these. Now I have tried x = x1 + x2 and y = y1 + y2, but that just comes out with a completely different function altogether. Can someone help?
Thanks!

1 comentario

Guillaume
Guillaume el 5 de Nov. de 2015
What do you mean? You can add, multiply, compose functions but 'combining' functions is not a mathematical term.
I don't understand what the problem is in the first place. What are you hoping to plot?

Iniciar sesión para comentar.

 Respuesta aceptada

Torsten
Torsten el 5 de Nov. de 2015

0 votos

x=horzcat(x1,x2);
y=horzcat(y1,y2);
plot(x,y)
Best wishes
Torsten.

1 comentario

Thorsten
Thorsten el 5 de Nov. de 2015
Instead of horzcat, you can also use
x = [x1 x2]
y = [y1 y2];

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Nov. de 2015

Comentada:

el 5 de Nov. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by