[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "table too short" error while trying to plot a function
From: |
Martin Helm |
Subject: |
Re: "table too short" error while trying to plot a function |
Date: |
Fri, 14 May 2010 18:56:53 +0200 |
User-agent: |
KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; ) |
Am Freitag, 14. Mai 2010 17:27:53 schrieb Leo Arias F.:
> On 05/14/2010 04:09 AM, Martin Helm wrote:
> > You will need to write your function in a vectorized form not in this
> > scalar form, for example something like
> >
> > function y = functiontest1(x)
> > y=zeros(size(x));
> > i1 = abs(x)<1;
> > i2 = 1 < abs(x) & abs(x) < 2;
> > y(i1) = 1;
> > y(i2) = 2-abs(x(i2));
> > endfunction
> >
> > Then it will work.
>
> Great, it does.
> Thanks a lot.
>
I noticed one very small thing, the function is not good defined for abs(x)=1
it should be
i1 = abs(x)<=1;
not
i1 = abs(x)<1;
- mh