From: Andrew on
I'm trying to simply plot a 215x7 matrix. It should be a plot with 7 bands but I am getting six and can't figure out why. Here's my code:

for i=1:215
for i=1:7
new(i,j)=i*j
end
end
surface(new')

Thanks in advance for any help
From: Steven Lord on

"Andrew " <bolka.a(a)verizon.net> wrote in message
news:i0fhul$7fq$1(a)fred.mathworks.com...
> I'm trying to simply plot a 215x7 matrix. It should be a plot with 7
> bands but I am getting six and can't figure out why. Here's my code:
>
> for i=1:215
> for i=1:7
> new(i,j)=i*j
> end
> end
> surface(new')
>
> Thanks in advance for any help

http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Andrew on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i0fjgu$llp$1(a)fred.mathworks.com>...
>
> "Andrew " <bolka.a(a)verizon.net> wrote in message
> news:i0fhul$7fq$1(a)fred.mathworks.com...
> > I'm trying to simply plot a 215x7 matrix. It should be a plot with 7
> > bands but I am getting six and can't figure out why. Here's my code:
> >
> > for i=1:215
> > for i=1:7
> > new(i,j)=i*j
> > end
> > end
> > surface(new')
> >
> > Thanks in advance for any help
>
> http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>

I guess my assumption that there are 7 sections is wrong. How can I get it to plot all of the data?
From: Andrew on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i0fjgu$llp$1(a)fred.mathworks.com>...
>
> "Andrew " <bolka.a(a)verizon.net> wrote in message
> news:i0fhul$7fq$1(a)fred.mathworks.com...
> > I'm trying to simply plot a 215x7 matrix. It should be a plot with 7
> > bands but I am getting six and can't figure out why. Here's my code:
> >
> > for i=1:215
> > for i=1:7
> > new(i,j)=i*j
> > end
> > end
> > surface(new')
> >
> > Thanks in advance for any help
>
> http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>

I guess my assumption that there are 7 sections is wrong. How can I get it to plot all of the data?
From: Andrew on
"Andrew " <bolka.a(a)verizon.net> wrote in message <i0fkdu$ocn$1(a)fred.mathworks.com>...
> "Steven Lord" <slord(a)mathworks.com> wrote in message <i0fjgu$llp$1(a)fred.mathworks.com>...
> >
> > "Andrew " <bolka.a(a)verizon.net> wrote in message
> > news:i0fhul$7fq$1(a)fred.mathworks.com...
> > > I'm trying to simply plot a 215x7 matrix. It should be a plot with 7
> > > bands but I am getting six and can't figure out why. Here's my code:
> > >
> > > for i=1:215
> > > for i=1:7
> > > new(i,j)=i*j
> > > end
> > > end
> > > surface(new')
> > >
> > > Thanks in advance for any help
> >
> > http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error
> >
> > --
> > Steve Lord
> > slord(a)mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
> >
>
> I guess my assumption that there are 7 sections is wrong. How can I get it to plot all of the data?

I added another column of just zeroes and it now shows the 7 sections