Hello,
i have two sets of points (x,y) and i want to plot the line that joins them. But i want it to stop at a specific point and start from the next one..(my datasets form quite big and i will need to break them in multiple points)
just for example:
a=[1 2 3 4 5 6 7 8 9 10]; b=[1 2 3 4 5 6 7 8 9 10];
plot(a,b)
gives me the continuous line
let say i want to stop to (5,5) and begin again from (6,6)
Thanks in advance
Vote for best question.
Score: 0
# Vote: 0
Date Posted: 29-Aug-2016, at 10:47 AM EST
From: thanos iliodro
Re: Plotting; Break a line in a specific point and continue
Thank you all..
my dataset were the coordinates of circles and when i plotted them, the last point of each circle was connected to the first of the next one.
Finally i used NaN in the last row as you suggested.
ang = linspace(0,2*pi,50); %50 point from 0:2pi
xp = r_sensor*cos(ang); %creates circle
yp = r_sensor*sin(ang);
temp_xp=[xp,NaN];
temp_yp=[yp,NaN];
for i=1:n_sensor
for j=1:51 %%%SOS 50 + 1 for the NaN element
x_kiklon(j,i)=x_average(i)+temp_xp(j);
y_kiklon(j,i)=y_average(i)+temp_yp(j);
end
end
x_kiklon=x_kiklon(:);
y_kiklon=y_kiklon(:);
plot_circle = plot(x_kiklon,y_kiklon,'r');
Thanks again!!
Vote for best answer.
Score: 0
# Vote: 0
Date Posted: 29-Aug-2016, at 2:28 PM EST
From: thanos iliodro
Re: Plotting; Break a line in a specific point and continue
"Nasser M. Abbasi" wrote in message
news:nq1772$17tf$1@gioia.aioe.org...
> On 8/29/2016 5:47 AM, thanos iliodro wrote:
>> Hello,
>> i have two sets of points (x,y) and i want to plot the line that joins
>> them.
>>But i want it to stop at a specific point and start from the
>>next one..(my datasets form quite big and i will need to break them in
>>multiple points)
>>
>> just for example:
>> a=[1 2 3 4 5 6 7 8 9 10]; b=[1 2 3 4 5 6 7 8 9 10];
>>
>> plot(a,b)
>> gives me the continuous line
>>
>> let say i want to stop to (5,5) and begin again from (6,6)
>>
>> Thanks in advance
>>
>
> humm... is this a trick question? ;)
>
> plot(a(1:5),b(1:5),a(6:end),b(6:end));
Or introduce NaN into the a and b vectors where you want the breaks to
appear. See the first Tip in the More About section of the documentation
page for PLOT for a small example.
http://www.mathworks.com/help/matlab/ref/plot.html
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
Vote for best answer.
Score: 0
# Vote: 0
Date Posted: 29-Aug-2016, at 9:56 AM EST
From: Steven Lord
Re: Plotting; Break a line in a specific point and continue
On 8/29/2016 5:47 AM, thanos iliodro wrote:
> Hello,
> i have two sets of points (x,y) and i want to plot the line that joins them.
>But i want it to stop at a specific point and start from the
>next one..(my datasets form quite big and i will need to break them in multiple points)
>
> just for example:
> a=[1 2 3 4 5 6 7 8 9 10]; b=[1 2 3 4 5 6 7 8 9 10];
>
> plot(a,b)
> gives me the continuous line
>
> let say i want to stop to (5,5) and begin again from (6,6)
>
> Thanks in advance
>
humm... is this a trick question? ;)
plot(a(1:5),b(1:5),a(6:end),b(6:end));
--Nasser