matlab

Octave time series Moving average

I have a matrix with each column represents a feature over time. I need to find the moving average of these values with a given window size. Is there any function like one in matlab output = tsmovavg(vector, 's', lag, dim) ? ...

Real time plot in matlab

Hi, I'm very new to matlab and I was trying to display a real time plot of some calculations. I have an N sized vector and I work with m (Say N=4m) values at a time so I want to plot the first m sized result and then as soon as the second m values are calculated have them replace the first plot. My approach was as follows: for i=1:N, ...

Axis labeling question

The x-axis and y-axis are interchanged in the figure by running the following matlab function I wrote. Could anyone tell me where the problem is or help me fix it? Thanks in advance for any help. function axislabeling(n) x=1:1:n; y=1:1:n; z=zeros(n,n); for i=1:n for j=1:n z(i,j)=i; end end surf(x,y,z(x,y)) xlabel('x-...

global in Matlab

hi guys im noob at Matlab and i cannot understand global variables. like=> global x y z what does global means? could you give me example? any help will be appreciated. ...

MATLAB weird output

I wonder if matlab has set restriction on variable's name. fixnb21=0; for fix=1:200 if fixdur(fix)>MIN_FIX_DUR && fixdur(fix)<MAX_FIX_DUR fixnb21 =fixnb21+1 fixdur21(fixnb21) =fixdur(fix) % I wonder if we are not allowed to add 21 at the end of variables or array name ... end end The fi...

matlab: finding length of an array of java objects

I have a java object (let's call it Foo) with a length() method. In MATLAB, I want to write a function that accepts an array of these objects and works with it. My problem is that the usual method of writing a loop breaks down: function doSomething(someArray) for i = 1:length(someArray) % do stuff with someArray(i) end ...

Difference between MATLAB's numel and length functions

I know that length(x) returns max(size(x)) and numel(x) returns the total number of elements of x, but which is better for a 1 by n array? Does it matter, or are they interchangeable in this case? EDIT: Just for kicks: Looks like they're the same performance-wise until you get to 100k elements. ...

simple Feed forward (newff) network in MATLAB

I used ffnew functions many times but when I am trying to create a simple feed forward network such that the input vector is P=[1;2;3;4] and the desired output is T=[1 ;0;0;1]. So i only have one sample input vector The code is net = newff(P,T,[4 1],{'tansig','tansig'}); net=train (net,P,T); When I write the last line I got: ??? Err...

array definition in matlab?

hi guys i' m noob at matlab and i wonder what the differences array definition for example: 1.) abc=[ 0 0 0 0 0 0] 2.) abc=[0;0;0;0;0;0] in C ,first definition is int abc[]={0,0,0,0,0,0}; second definition is int [6][1]= {{0},{0},{0},{0},{0},{0}}; am i correct about that? any help will be appreciated. ...

What are the advantages/disadvantages between R and MATLAB with respect to Machine Learning?

I am beginning some studies into machine learning and it seems these two are often used in this field. They seem very similar, so how would one decide which is best to use? ...

code for Steady filming

I need to write code for stable filming vibrations ...

fitting in neural network with MATLAB

I want to fit a function using neural networks, with 0/1 as outputs. please help me find the best way to it. In fact I want to know the fitting function in MATLAB, specifically in the neural network toolbox. I don't know which method is good for modeling a function with binary output. Also is there anyway in MATLAB that I can gain weig...

Using matlab to calculate the properties of a polygon defined as a list of points

Does MATLAB have a built-in function to find general properties like center of mass & moments of inertia for a polygon defined as a list of (non-integer valued) points? regionprops performs this task for integer valued points, on the assumption that these represent indices of pixels in an image. But the only functions I can find that...

what the mean of the following MATLAB code

please help me to understand this code: x(:,i) = mean( (y(:,((i-1)*j+1):i*j)), 2 )'; i can't find it in my book. thanks. ...

Logical vs Numerical array in MATLAB

I am comparing two binary arrays. I have an array where values can either be one or zero, one if the values are the same and zero if they are not. Please note I am doing other stuff beyond checking, so we don't need to get into vectorization or the nature of the code. What is more efficient, using a numerical array or a logical array in...

Matlab big matrix

Hello everyone !! I'm trying to use matlab for the first time but I'm having a problem because the matrix I'm using is too big, I think.. I command I'm trying is: m=[1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;1692017;169201]7;531456;1692017;1692017;1692017;1692017;1692017;1692017;1692017;169...

read and rewrite in matlab

http://stackoverflow.com/questions/1905061/how-do-i-write-a-text-file-in-the-same-format-that-it-is-read-in-matlab I looked and my question is almost the same as above question. I want to read in a file which is 84641 x 175 long. and i want a make a new .txt file with 84641 x 40 , deleteling rest of the columns. I have 2 rewrite the d...

How to compile matlab script for specified Matlab Runtime (MCR)

Hello. I have Matlab 2010a installed on my machine, and MCR 7.6 installed on client's machine. I try to figure out how can I compile my code for MCR 7.6. Currently mcc comlipes scripts for 7.9 ( which has been installed with Mathlab). Does mcc has any arguments for it, or parameters in cfg file? (or anything else) Thank you. ...

Using MATLAB loop funtion to name calculate variables

I need to calculate the mean, std, and other numbers for my programming and I was wondering how to use the loop function to my advantage. I have 5 electrodes of data. So to calculate the mean of each I used: mean_ch1 = mean(ch1); mean_ch2 = mean(ch2); mean_ch3 = mean(ch3); mean_ch4 = mean(ch4); mean_ch5 = mean(ch...

Lsqcurvefit for 2D data

How do you use lsqcurvefit to fit a 2D function to a 2D array? ...