octave

How to find coefficients for a possible exponential approximation

爷,独闯天下 提交于 2019-12-12 05:39:05
问题 I have data like this: y = [0.001 0.0042222222 0.0074444444 0.0106666667 0.0138888889 0.0171111111 0.0203333333 0.0235555556 0.0267777778 0.03] and x = [3.52E-06 9.72E-05 0.0002822918 0.0004929136 0.0006759156 0.0008199029 0.0009092797 0.0009458332 0.0009749509 0.0009892005] and I want y to be a function of x with y = a(0.01 − b*n^−cx). What is the best and easiest computational approach to find the best combination of the coefficients a , b and c that fit to the data? Can I use Octave? 回答1:

Dependency library not recognized during installation octave forge dicom package in debian linux

无人久伴 提交于 2019-12-12 04:56:29
问题 I ask this question on this stack exchange because it has (by far) the most posts about octave. I started using a linux environment and want to use octave for my work, for which the dicom package is essential (my data is in the dicom format and not readily converted to nifti because of its high dimensionality, it would require many,many seperate files). The dicom package is dependend on the gdcm library, which I have installed. The when installing the dicom package I get this error: fatal

using timer in MATLAB to extract the system time

ぃ、小莉子 提交于 2019-12-12 04:54:28
问题 !I am using MATLAB to design an Analog Clock. Currently, my code simply displays the (or plots rather) the clock design with the hands (hours, mins, secs) and does not tick. Here is my code: function raviClock(h,m,s) drawClockFace; %TIMER begins------- t = timer; t.ExecutionMode = 'FixedSpacing'; %Use one of the repeating modes t.Period = 1; %Fire on 1 second intervals t.TimerFcn = @timer_setup; %When fired, call this function start(t); set(gcf,'DeleteFcn',@(~,~)stop(t)); end function timer

maxima multiple trigonometric equations

巧了我就是萌 提交于 2019-12-12 04:52:12
问题 I'm trying to solve an equation using maxima 13.04.2 but the answer isn't what I expect. Example: y2=A2*cos(2*pi*f2*t+phase2) we know A2=.4,f2=6.4951,t=1, trying to find **phase2** y2=.4*cos(2*pi*6.4951+phase2) I tried to solve the y2 equation for phase2 in maxima but it got rid of the cos function kill(all); A:A; phase:phase; solve(A*cos(2*pi*f*t+phase)=0,phase); The answer that came back was I thought something like this was suppose to come back y2 = A2×cos(2πf2t + φ2) ⇒ y2/A2 = cos(2πf2t +

How to count the number of lines in a text file in Octave?

可紊 提交于 2019-12-12 04:47:51
问题 And don't say fskipl because it doesn't work!!! fskipl undefined . 回答1: Do you have fgetl ? If so, you can do this little loop: f = fopen('myfile.txt', 'rt'); ctr = 0; ll = fgetl(f); while (!isnumeric(ll)) %# fgetl returns -1 when it hits eof. But you can't do ll != -1 because blank lines make it barf ctr = ctr+1; ll = fgetl(f); end fclose(f); Otherwise, you could do some hack like: f = fopen('myfile.txt', 'rb'); ctr = 0; [x, bytes] = fread(f, 8192); %# use an 8k intermediate buffer, change

Assigning a variable with zero value if not existing in loaded file (Octave)

给你一囗甜甜゛ 提交于 2019-12-12 04:36:27
问题 The Case1.Mat file contains X Y Z 2 6 3 3 7 4 4 8 6 5 9 8 load(Case1.Mat); # loaded a Case1.Mat file in Octave label=[{X;Y;Z;V}]; # I have a matrix of predefined variables Nrow=numel(label); ResMat=ones(Nrow,1); for k=1:Nrow; ResMat(k,1)=max(label{k,1}); End I have just shown the example of simplification of my problem, however in my case the Mat file contains >300 Variables, and for each case the number of variables changes. Hence I have defined a label matrix with all the variables. In the

converting/ translate from Python to Octave or Matlab

走远了吗. 提交于 2019-12-12 03:53:32
问题 I have a Python-Code and want to rewrite it in Octave, but I meet so many problems during the converting. I found a solution for some of them and some of them still need your help. Now i would start with this part of the code : INVOLUTE_FI = 0 INVOLUTE_FO = 1 INVOLUTE_OI = 2 INVOLUTE_OO = 3 def coords_inv(phi, geo, theta, inv): """ Coordinates of the involutes Parameters ---------- phi : float The involute angle geo : struct The structure with the geometry obtained from get_geo() theta :

Install Octave packages on ubuntu 16

你离开我真会死。 提交于 2019-12-12 03:43:13
问题 I tried several commands to install the package optim into my Octave in Ubuntu 16.10 to use the function xcorr , but I miserably failed. Some of these commands were: - sudo apt-get install octave-optim - sudo apt-get install liboctave-dev - sudo apt-get install octave-signal - sudo apt-get install octave-pkg-dev Can somebody explain me or does somebody know how to install the packages in Ubuntu 16? After running the above-mentioned commands, I restarted Octave but the command xcorr() was

Reading out the direction and frequency of a point in the Matlab 2D DFT fft2() function

和自甴很熟 提交于 2019-12-12 03:39:55
问题 I am getting familiarized with Matlab and the function fft2() . In this toy example, I am aiming at producing the 2D DFT of the following 256 x 256 png image: To be able to understand the output easily, I try to convert this image into a 256 x 256 image, eliminating color information: Im = imread('circ.png'); pkg load image Im = rgb2gray(Im); figure, imshow(Im) After this bookkeeping preliminaries I run: A = fft2(double(Im)); A is a 256 x 256 matrix from which amplitude and phase can be

How to pass vectors to GNU Octave functions in C++ programs?

眉间皱痕 提交于 2019-12-12 03:22:39
问题 Out of " How to exit GNU Octave, after running an m file, without closing plot windows? " came the question of whether one can pass vectors from a C++ program to a GNU Octave function. I have this C++ program: #include <iostream> #include <vector> #include <string> #include <fstream> #include <cmath> #include <utility> #include <unistd.h> #include <octave/oct.h> #include <octave/octave.h> #include <octave/parse.h> #include <octave/toplev.h> using namespace std; double N = 1000.0; double t0 =