matlab

Octave: Multiple submatrices from a matrix

I have a large matrix from which I would like to gather a collection of submatrices. If my matrix is NxN and the submatrix size is MxM, I want to collect I=(N - M + 1)^2 submatrices. In other words I want one MxM submatrix for each element in the original matrix that can be in the top-left corner of such a matrix. Here's the code I have...

animation in Matlab

how to animate a surface if it's coordinates change in time (e.g. ellipsoid) using Matlab? ...

MATLAB is changing variables when I do not want it to.

Here is my problem in a small bit of code used as an example: function [] = trial(test) disp(test) if(test == 1) disp('test is one') test = 0; end disp(test) When I execute > trial(0) Matlab prints out this: 0 'test is one' 0 This is not my real code, there are over 500 lines of it, but this is a section of my code whe...

Is there any function in Matlab for changing the form of matrix?

Hi, I have to get the unknown matrix by changing the form of known matrix considering the following rules: H = [-P'|I] %' G = [I|P] where H is known matrix G is unknown matrix which has to be calculated I is identity matrix So for example if we had a matrix H = [1 1 1 1 0 0; 0 0 1 1 0 1; 1 0 0 1 1 0] its form has ...

Find location of current m-file in Matlab

I'm working on my Matlab code in a number of different locations and it would really help if I could make the code aware of its location on the computer. I think there is a function that gives me exactly this information, but I can't remember what it is called or find it on Google. The idea is that I have a function myFunc that needs a ...

MATLAB Heart Curve

I am trying to get this in MATLAB, however I am not successful ! Any MATLAB gurus out there ? I guess simple commands should work, a program may not be needed. The error, I am getting is; >> t = -pi:0.1:pi; >> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ; ??? Error using ==> mtimes Inner matrix dimensions must ...

Plotting Implicit Algebraic equations in MATLAB

I wish to plot implicit functions in MATLAB. Like x^3 + xy + y^2 = 36 , equations which cannot be made into simple parametric form. Is there any simple method ? I guess it is a very noob-ish question, sorry ..... have never gone exotic in MATLAB ! ...

How to create a function with vectors and vertical asymptote using MATLAB

Plot the function f(x) = 1.5x / x-4 for -10 equal or less than X equal or less than 10. Notice that the function have a vertical asymptote at x = 4. Plot the function by creating two vectors for the domain of x. The first vector (call it x1) with elements from -10 to 3.7, and the second vector (calle it x2) with elements from 4.3 to 10. ...

sorting a timer in matlab

ok it seems like a simple problem, but i am having problem I have a timer for each data set which resets improperly and as a result my timing gets mixed. Any ideas to correct it? without losing any data. Example timer col ideally should be timer , mine reads 1 3 2 4 3 5 4 6 5 ...

How do you concatenate the rows of a matrix into a vector in MATLAB?

For an m-by-m (square) array, how do you concatenate all the rows into a column vector with size m^2 ? ...

MATLAB: Convert two array to a sparse matrix

I'm looking for an a command or trick to convert two arrays to a sparse matrix. The two arrays contain x-values and y-values, which gives a coordinate in the cartesian coordinate system. I want to group the coordinates, which if the value is between some value on the x-axes and the y-axes. % MATLAB x_i = find(x > 0.1 & x < 0.9); y_i = f...

MatLab (stats, data processing)

I've got an m x m array. I want to apply Fisher discriminant analysis to it - the LDA in MatLab's stats toolbox isn't the Fisher one so I used the version provided by the supplementary toolbox stprtool package. http://cmp.felk.cvut.cz/cmp/software/stprtool/index.html How do I run my program? I don't really understand the input required:...

merging and manupulating files in matlab

Is there a way to run a loop through a folder and process like 30 files for a month and give the average,max of each columns and write in one excel sheet or so?? I have 30 files of size [43200 x 30] I ran a different matlab scrip to generate them so the names are easy File_2010_04_01.xls , File_2010_04_02.xls ..... and so on I cannot ...

MATLAB expression column indexing

I have an expression that gives a matrix and I want to access an element, without creating a temporary variable, something like this cov(M)(1,1). How can I do it? Thanks! ...

MATLAB postpones disp calls when doing demanding calculations. Why is that?

I am implementing an algorithm in MATLAB. Among other things it calculates the shortest paths etc. so it's quite demanding for my old computer. I've put in disp() calls through out the program to see what's happening all the time. However when starting on a particulary heavy for loop the disp() seemes not to be called until the loop is...

Funny plots in MATLAB: what does lower scale mean?

I recently learned the ezplot function in MATLAB. Recently I typed in ezplot('x^y - y^x', [-100 100 -100 100]); and this is what I got; Can anyone please tell me whatever is happening ? for lower scaling of x and y ( [ -10 10 -10 10]) there are more patterns in the 2nd 3rd and 4th quadrants. I was not very sure of the shape o...

Implementing custom Matlab functions in Simulink

Hi, I would like to use custom Matlab function in Simulink. So far I have done it by placing Embedded Matlab Fuction block. However if the custom function contains another custom function the compile process fails. Here is the example of function I am trying to embed in the simulation: function [c, d, iterationsCount] = decodeLDPC(y, ...

Passing functions as arguements in Matlab

Hi, I'm trying to write a function that is gets two arrays and the name of another function as arguements. e.g. main.m: x=[0 0.2 0.4 0.6 0.8 1.0]; y=[0 0.2 0.4 0.6 0.8 1.0]; func2(x,y,'func2eq') func 2.m : function t =func2(x, y, z, 'func') //"unexpected matlab expression" error message here t= func(x,y,z...

site for simulink projects?

hello could anyone give me a site in which i can find simulink projects? i want simulink project (not MATLAB codes) so where can i find this? mathworks site offer a lot of projects most of which are written with matlab code please help thank you ...

Matlab time stamps reading

Any easy way to read all the columns in Matlab? my format is date time y1 y2 y3 y4 ......................... 4/27/2010 00:3:09 34 45 45 56 ................ so on currently i am reading these with the code [c,pathc]=uigetfile({'*.txt'},'Select the data','C:\Data'); file=[pathc c]; data= dlmread...