Draw multiple lines on the same graph in Matlab? plot() or something else? -


i want draw several dots, , lines connecting of dots. programmed this:

prompt = 'please enter file name: '; filename = input(prompt, 's'); saturationfile=fopen(filename);  porecount  =fscanf(saturationfile, '%d\n', 1); throatcount=fscanf(saturationfile, '%d\n', 1);  pi=fscanf(saturationfile, '%d\n', porecount); px=fscanf(saturationfile, '%f\n', porecount); py=fscanf(saturationfile, '%f\n', porecount); ps=fscanf(saturationfile, '%d\n', porecount);  ti=fscanf(saturationfile, '%d\n', throatcount); tb=fscanf(saturationfile, '%d\n', throatcount); te=fscanf(saturationfile, '%d\n', throatcount); ta=fscanf(saturationfile, '%f\n', throatcount); tl=fscanf(saturationfile, '%f\n', throatcount); ts=fscanf(saturationfile, '%d\n', throatcount);  tb=tb+1; te=te+1;  maxa=0; i=1:throatcount     if ta(i)>maxa          maxa=ta(i);     end end  scale=10; px  =px  *scale; py  =py  *scale; ta  =ta  *scale; maxa=maxa*scale;  i=1:throatcount     if ts(i)==0         c='cyan';     else         c='black';     end     plot([px(tb(i)) px(te(i))], [py(tb(i)) py(te(i))], 'color', c, 'linewidth', ta(i)); end  i=1:porecount     if ps(i)==0         c='cyan';     else         c='black';     end     rectangle('position', [(px(i)-0.5*maxa) (py(i)-0.5*maxa) maxa maxa], 'facecolor', c, 'edgecolor', c, 'curvature', [1 1]); end 

the resulting picture this: unbelieveable, sorry, cannot post pictures, if run program sample data, picture.

the sample input file:

9 10 0 1 2 3 4 5 6 7 8 1.16667 1.16667 1.16667 1.5 1.5 1.5 1.83333 1.83333 1.83333 -0.666667 -0.333333 0 -0.666667 -0.333333 0 -0.666667 -0.333333 0 1 1 0 1 1 0 1 1 0 0 1 2 3 4 5 6 7 8 9 0 0 1 1 3 3 4 4 6 7 1 3 2 4 4 6 5 7 7 8 0.0610206 0.0606029 0.0601841 0.0612494 0.0593242 0.0589063 0.0599607 0.0595583 0.0591209 0.0601974 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 1 1 1 1 1 1 1 1 1 1 

question1: defined, there should 10 lines draw between dots, why there 1 line there?

question2: looks dots scaled up, line remain narrow thin line, why?

thanks! please me out, got stuck long time.

you have put figure, hold on before starting plot (before throatcount loop).


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -