octave

Finding a curve to match data

橙三吉。 提交于 2019-12-29 03:30:47
问题 I'm looking for a non-linear curve fitting routine (probably most likely to be found in R or Python, but I'm open to other languages) which would take x,y data and fit a curve to it. I should be able to specify as a string the type of expression I want to fit. Examples: "A+B*x+C*x*x" "(A+B*x+C*x*x)/(D*x+E*x*x)" "sin(A+B*x)*exp(C+D*x)+E+F*x" What I would get out of this is at least the values for the constants (A, B, C, etc.) And hopefully stats about the fitness of the match. There are

Octave / Matlab: Extend a vector making it repeat itself?

房东的猫 提交于 2019-12-27 10:32:38
问题 Is there a way to extend a vector by making it repeat itself? >v = [1 2]; >v10 = v x 5; %x represents some function. Something like "1 2" x 5 in perl Then v10 would be: >v10 1 2 1 2 1 2 1 2 1 2 This should work for the general case, not just for [1 2] 回答1: The function you're looking for is repmat(). v10 = repmat(v, 1, 5) 回答2: Obviously repmat is the way to go if you know in which direction you want to expand the vector. However, if you want a general solution that always repeats the vector

Octave says variables are undefined even when they are

末鹿安然 提交于 2019-12-25 12:51:43
问题 I have the following code function W = robust(a,c,y) W = pinv(a' * c * a) * a' * c *y; endfunction However, when I try running it, I get the following error. error: 'a' undefined near line 4 column 12 error: called from robust at line 4 column 5 This makes no sense at all. What am I doing wrong here? EDIT: I'm calling this via emacs. So, I'm using the command 'octave-source-file', which executes the file in the inferior octave process. I see that it works if this buffer isn't where I start

configure settings for Installing Octave 4.0.3 in Ubuntu 16.04

心已入冬 提交于 2019-12-25 08:13:20
问题 So i am following steps to install the latest version of octave from here. sudo apt-get install g++ gcc gfortran make autoconf automake bison flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar sudo apt-get install libblas-dev liblapack-dev libpcre3-dev libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev transfig libfltk1.3-dev libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev gnuplot libgraphicsmagick++-dev libhdf5-serial-dev openjdk-9-jdk libsndfile1

javaoctave jar file has failed in Mac OSX Eclipse

守給你的承諾、 提交于 2019-12-25 07:36:09
问题 Hi I am currently using Eclipse Kepler for my java project. I wanted to use the Octave (the open sourced MatLab) for calculation. Therefore I have tried to use the javaoctave (https://kenai.com/projects/javaoctave) to help me do the calculation in java. However, when I want to compile my code I get the following error: Exception in thread "main" dk.ange.octave.exception.OctaveIOException: java.io.IOException: Cannot run program "octave": error=2, No such file or directory at dk.ange.octave

Inserting items in an array every nth place in octave / matlab

强颜欢笑 提交于 2019-12-25 06:59:20
问题 How can I insert elements in an array (a2) every nth place in (a1) Example: Logic a1 = [1,10,2,20,3,30,4,40,5,50]; a2 = [100,200,300,400,500]; n=3 % n would be the position to place the elements found in (a2) every **nth** position in (a1). *n is the starting position at which the array a2 is inserted into a1* The new a1 if n=3 after inserting a2 into it would look like a1 = [1,10,100,2,20,200,3,30,300,4,40,400,5,50,500]; The new a1 if n=2 after inserting a2 into it would look like a1 = [1

Arranging group of numbers to fit Specific size total

 ̄綄美尐妖づ 提交于 2019-12-25 05:08:03
问题 I have several different numbers in a group that range in sizes and would like to calculate which group the numbers should go in based on the max size the group can be. Example of the numbers: 10,20,30,40,50,60 Example of conditions: the maximum total the numbers can add up to in a group is 60 So from the example above the answer would be: group 1 would have the numbers 10,20,30 group 2 would have the number 40 group 3 would have the number 50 group 4 would have the number 60 Is there a way

Reading and playing sound in Octave on Fedora12

若如初见. 提交于 2019-12-25 04:19:29
问题 I would like to read a wav file and play it in octave. I am using octave 3.4.0 on fedora 12. This is my code - 1. [audio_samples,fs] = wavread("myaudio.wav"); sound(audio_samples,fs); To this octave complained that "Sound function is not implemented" Then I tried [audio_samples,fs] = wavread("myaudio.wav"); playsound (audio_samples); To this I get following from octave - error: Invalid call to playaudio. Upon some preliminary debugging for #2 above I see that playaudio(x) function first

How not to repeat values in array using matlab / octave

感情迁移 提交于 2019-12-25 04:07:39
问题 Thanks goes out to Shai for getting my code to be much more efficient. The link to the original thread is here. Original Thread How can I have a loop check and stop if a number in the "array_all" array has been repeated from the "x" array. Example: Here's the code below: x=[9,8,7,6,5,4,3,2,1] array_all = bsxfun( @times, x(:), [1 .5 .25] ) %// generate for all values eq_ = bsxfun( @eq, array_all, permute( x(:), [3 2 1] ) ); eq_ = max( eq_, [], 2 ); %// we do not care at which column of array

How do I use m_map in octave

若如初见. 提交于 2019-12-25 01:49:13
问题 I have installed octave on linux ubuntu running as a guest on ubuntu. I am able to plot contours and from http://www2.ocgy.ubc.ca/~rich/map.html#examples. I have also installed m_map and gshhs (both for gmt and for shapefiles, and gmt has been installed). From the instructions on the above site, am not able to link my script (mfile) to the basemap. My script is below #!/usr/bin/octave data=load('meansr.txt'); x = data(:,1); y = data(:,2); obs = data(:,3); % create a regular mesh [xi,yi] =