help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable and plot


From: Nicholas Jankowski
Subject: Re: variable and plot
Date: Tue, 10 Apr 2018 12:35:47 -0400

(please keep the help list in the reply chain)

On 4/10/18, Patrick Dupre <address@hidden> wrote:
>> 2)
>> I have a function
>> function y = Voigt (x, wD, g)
>>   y = quad (@(t) w (x, t, wD, g), -10,10);
>> endfunction
>>
>> which seems to work
>>
>> Voigt (0, 5, 0.1)
>> ans =  30.719
>>
>> but, I cannot plot it
>>
>> x=-10:0.1:10;
>>  plot (x, Voigt (x, 4,0.1));
>> This gives me a constant value.
>
>
>
> You need to understand the outputs of your functions. Run Voigt(x, 4, 0.1)
> before the plot line and see what your output looks like. quad will only
> produce a scalar output. So it seems you are calling plot with an array for
> the x value and a single constant for the y value.
>
>
> I guess that it is the right argument. The question is hwo do I manage the x
> vector?
> In other words, what is the difference between
> x=-10:0.1:10
> plot (x, sin (x))
> and my function?
> plot (x, Int_Sat (x, 2, 1, 0.1, 0.01))
>
> function y = Int_Sat (x, Shift, wD, g, s)
>   y = quad (@(t) Sat (x, t, Shift, wD, g, s), 0, 15) ;
> endfunction
>
>


Sin(x) will take a vector input and produce a vector otuput. if
Int_Sat does not produce a vector output, then the plot function will
not have a vector to work with.  plot is not working with one value of
x at a time, it is working with two matrices, but Int_Sat produces a
matrix of size (1,1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]