From: Philosophaie on 3 Aug 2010 10:26 I need to draw a line between data points so that I can get a "Data Fitting" linear or polynomial equation. This will not draw a line between data points even if I have '-b' in the plot. ra(1900)=1*15+22.6/60 ra(1950)=1*15+48.8/60 ra(1990)=2*15+21.3/60 ra(2000)=2*15+31.8/60 ra(2010)=2*15+43.6/60 ra(2050)=3*15+47.6/60 hold on; for k=1900:10:2050 if ra(k)~=0 plot(k,ra(k),'-b'); end end
From: John D'Errico on 3 Aug 2010 10:43 "Philosophaie" <ertlejack(a)sbcglobal.net> wrote in message <i398ts$2a6$1(a)fred.mathworks.com>... > I need to draw a line between data points so that I can get a "Data Fitting" linear or polynomial equation. This will not draw a line between data points even if I have '-b' in the plot. > > ra(1900)=1*15+22.6/60 > ra(1950)=1*15+48.8/60 > ra(1990)=2*15+21.3/60 > ra(2000)=2*15+31.8/60 > ra(2010)=2*15+43.6/60 > ra(2050)=3*15+47.6/60 > > hold on; > for k=1900:10:2050 > if ra(k)~=0 > plot(k,ra(k),'-b'); > end > end Learn to use matlab as it is designed to be used. k = [1900 1950 1990 2000 2010 2050]; ra = [1*15+22.6/60,1*15+48.8/60, ... 2*15+21.3/60, 2*15+31.8/60, ... 2*15+43.6/60, 3*15+47.6/60]; plot(k,ra,'-b') Read the manual. Start with the tutorials. John
|
Pages: 1 Prev: How to close a figure without critical error Next: Problem with publishing and debugging |