This way you have a vectorized version of the integral of $f$. defining $g$ as following function y = g(x)į = ( (1). To do what is demanded in the question above, the simpler way is recurring to a loop, e.g. To my knowledge integration procedures are given most of the time in scalar form (not vectorized!). The problem is here that function quadcc is not vectorized, you cannot enter an $x$ which is a vector into quadcc. In order to plot the integral of $f$, we have to understand its integral $g$ must be also a vector. if $x$ is a vector, then $f$ is also a vector). Which, in terms of GNU Octave, is a vectorized function (i.e. GNU Octave Scientific Programming Language Powerful mathematics-oriented syntax with built-in 2D/3D plotting and visualization tools Free software, runs on GNU/Linux, macOS, BSD, and Microsoft Windows Drop-in compatible with many Matlab scripts Syntax Examples The Octave syntax is largely compatible with Matlab. GNU Octave is based on vector and matrices. I do not know if it is valuable to answer this question at this moment, but it is indeed a valuable question in terms of how to use (and think in terms of) GNU Octave. So I cannot compute the integrals by hand like I could in this simple case. I need to integrate the real function 3 times in succession (f represents a jerk and I need to determine functions for acceleration, velocity and distance). This is just a simplified version of the real function I use, but the real function is also constant on a finite set of intervals ( number of intervals is less than ten if that matters). Of course I know that I can use a for loop and add every point individually, but I find it hard to believe that there isn't already some way to do that using vectors. So I understand what's the reason for the error but have no clue how to get the desired result instead. I want to be able to plot the 3d plot with every point having a colour of its specific color index. * and((1 <=2))) īut receive the following error: quadcc: upper limit of integration (B) must be a single real scalarĪs far as I can tell this is because the plot passes a vector (namely x) to g which passes it down to quadcc which cannot handle vector arguments for the third argument. I can evaluate the function g like g(1.5) but plotting fails. I try to integrate a function and plot it in Octave.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |