|
From: | Doug Stewart |
Subject: | Re: displaying an image |
Date: | Sat, 12 Sep 2015 17:42:16 -0400 |
I understand that 21 defines the spacing/how many points there are, but why 21?
On Sat, Sep 12, 2015 at 2:05 PM, Nicholas Jankowski <address@hidden> wrote:On Sat, Sep 12, 2015 at 5:02 PM, lana frankle <address@hidden> wrote:On Sat, Sep 12, 2015 at 1:59 PM, Nicholas Jankowski <address@hidden> wrote:and Ben missed a . the second line should be:On Sat, Sep 12, 2015 at 4:39 PM, lana frankle <address@hidden> wrote:That works to give a figure but the line is straight horizontal, I don't think it represents the equation I'm trying to use. And where does the 21 come from?On Sat, Sep 12, 2015 at 1:27 PM, Ben Abbott <address@hidden> wrote:On Sep 12, 2015, at 4:20 PM, lana frankle <address@hidden> wrote:On Sat, Sep 12, 2015 at 1:00 PM, Nicholas Jankowski <address@hidden> wrote:It's not just the case-sensitive thing though because that error message shows before I try to plot. x>=-3 and x=<5 was given in the problem I'm trying to work from the book "MATLAB: An Introduction with Applications". The error shows right after I define y. My code is:well, hard to guess without seeing the actual code you're using. Note you can use a text editor or the built in editor to write your commands in a script file, (one command per line just like you'd type on the command line). then save it as a filename.m file, and you can run the script by typing 'filename'. this allows you to edit code you run more than once, get into programming, etc.On Sat, Sep 12, 2015 at 2:56 PM, lana frankle <address@hidden> wrote:On Sat, Sep 12, 2015 at 12:07 AM, Andy Buckle <address@hidden> wrote:On 12 September 2015 at 06:02, lana frankle <address@hidden> wrote:Octave is giving me the following error while I'm trying to do 2-D plotting:>> y=((x+5).^2)/(4+3*x.^2)y = 1.5625>> figure plot(X,Y)error: figure: N must be figure handle or figure numbererror: called fromfigure at line 67 column 7I'm not sure what it means. Where do I put the "N"?you are sending plot as an argument to figure. you probably want to put them on separate linesfigureplot(X,Y)The error is coming from figure, so in general you should look at the help for the figure function. like thishelp figureit explains that calling figure with an argument N is useful when you have multiple figures open and you want to switch back to one created earlier.
--/* andy buckle */now it's telling me "error: 'x' undefined near line 1 column 5".I'm not sure the code I'm entering prior to the line where I define y is exactly the same as it was yesterday (I didn't save the code in the command window) right now it'sif x>=3 and x=<5:Assuming the code above is like what you're running, you're defining x and y but trying to plot X and Y. Octave is case sensitive so those are not the same.
> right now it's> if x>=3 and x=<5:I'm not sure what you mean by this as it has nothing to do with the code listed above.if x>=-3 and x=<5:y=((x+5).^2)/(4+3*x.^2)error: 'x' undefined near line 1 column 5#and once that's resolved, I'll want to dofigureplot(X,Y)(will I need a semi-colon after figure?)Just guessing, is this what you’re trying to do?x = linspace (3, 5, 21);figurey=((x+5).^2)/(4+3*x.^2);plot (x, y)BenDid you try
help linspaceto figure out where the 21 came from?
y=((x+5).^2)./(4+3*x.^2);Ben gave me the 21. I don't know why.'help linspace' would tell you why. Allow me:
>> help linspace
'linspace' is a built-in function from the file libinterp/corefcn/data.cc
-- Built-in Function: linspace (BASE, LIMIT)
-- Built-in Function: linspace (BASE, LIMIT, N)
Return a row vector with N linearly spaced elements between BASE
and LIMIT.
If the number of elements is greater than one, then the endpoints
BASE and LIMIT are always included in the range. If BASE is
greater than LIMIT, the elements are stored in decreasing order.
If the number of points is not specified, a value of 100 is used.
The `linspace' function always returns a row vector if both BASE
and LIMIT are scalars. If one, or both, of them are column
vectors, `linspace' returns a matrix.
For compatibility with MATLAB, return the second argument (LIMIT)
if fewer than two values are requested.
See also: logspace.
Additional help for built-in functions and operators is
available in the online version of the manual. Use the command
'doc <topic>' to search the manual index.
_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave
[Prev in Thread] | Current Thread | [Next in Thread] |