Skip to content

comp.soft-sys.matlab

Home arrow Newsgroups arrow comp.soft-sys.matlab


comp.soft-sys.matlab
The MathWorks calculation and visualization package.

  • Re: Finding the nearest matrix with real eigenvalues
    - - - - - - - - -
    Neither of those seem like very satisfying metrics to me, Matt. They depend on the particular similarity transformation that diagonalizes (or nearly diagonalizes) the original matrix, A, with its complex-valued eigenvalues. The matrix that diagonalizes B to its real-valued eigenvalues will be different, and since for B there will now be two equal eigenvalues, it isn't even unique. One would hope for a metric between the two matrices that has commutative symmetry between the matrices. Commutativity is one of the axioms in the usual definition of a metric space. Also if S is nearly singular, norm(inv(S)*M*S,'fro') can be very much larger than norm(M,'fro') and therefore perhaps of no particular interest in minimizing.

  • Re: integer a function in matlab
    ...
    QUAD Numerically evaluate integral, adaptive Simpson quadrature.
    QUAD8 Numerically evaluate integral, higher order method.
    QUADL Numerically evaluate integral, adaptive Lobatto quadrature.
    ...
    Hope this helps.
    Greg

  • Re: Good way to compare two cell arrays???
    not 100% sure, but i think this should do what you want
    clc
    clear all
    files={'file1';'file2';'file3' };
    finishedfiles={'file3';'file2' };
    a=repmat(files,size(finishedfi les));
    b=sort(repmat(finishedfiles,si ze(files)));
    c=(strcmp(a,b));
    d=reshape(c,size(files,1),size (c,1)/size(files,1));
    newfiles=files(~logical(sum(d, 2)))

  • Re: Reorganize data
    Here's a way using loops:
    for itype=1:10
    cols{itype}=D(1,:) == itype; % remember this for later
    d{itype}=D(:,cols{itype});
    end
    Later, to put all the pieces together again
    D1=D; % Allocate storage
    for itype=1:10
    D1(:,cols{itype})=d{itype};
    end

  • Regime-Switching GARCH (Juri Marcucci's Paper)
    Any success yet?
    I've had the same problem. I'm sending an e-mail directly to the author, though. If I get any answers I'll let you know.

  • Reorganize data
    Hello all -
    I have an arry of data called 'D' that has this size n-by-100. In first row of the data there is a specific vector that shows type of each column. Number of 1 to 10 was assigned to distinguish these types. I am going to generate these 10 different submatrices {d1,d2...., and d10} from original data ('D'), wherein d1 collects all type-1 and d2 accomodates all type-2, and so on. How can I creat these submatrics and after doing some functions return them to their original format.

  • Re: Good way to compare two cell arrays???
    help intersect

  • Problems with checkbox
    Hi all,
    I'm having an issue with the 'checkbox' in a GUI I'm working on. The problem is that regardless if the checkbox is marked or not, the handle always has the same value. The handle hcheckhold is always 4.0248... I need to have 2 different values! here's the code
    hcheckhold = uicontrol('Style','checkbox',' String','Hold',...

  • Re: Capacity of a listbox
    Not off-hand, but somewhere over 1500, as I have used that much before.

  • Re: Matlab vs. VBA
    Your previous postings were quite specific that you did not want any
    assumption made about what might be of interest or not. Very specific details
    about some aspects of a language are sometimes crucial to a use, so the only
    way to answer your previous unrestricted query would be through exhaustive

  • Re: Orientation of an animal's head
    On Sep 2, 4:52 pm, "Thomas Hippocampus"
    One possibility is to first fit a skeleton to the shape. Then finding
    the head and its direction is trivial. For example:
    [link]
    From a quick Google scholar search though people tend to solve this in
    a much more pragmatic fashion, that is, by taping a green and a red

  • Re: Orientation of an animal's head
    Looks challenging. I guess what I'd try is to first get rid of the
    tail, hopefully by using a morphological opening. Then I'd probably
    get the boundary with bwboundaries() and run along looking for the
    sharpest angle, which might be the nose. But if it had its nose
    tucked into its side, you might have a spurious sharp angle there.

  • Re: Finding the nearest matrix with real eigenvalues
    The usual way people do optimization is that: one define first the norm then minimize it. This logic is not for turning up-side-down. If one peak a specific solution in the admissible set, then arrange the definition of the norm (definition that depends on the input) so as the solution is the projection, then it's not rigorous method because one does really know what is minimized and that does not allow various bound estimation. Furthermore the eigen-vectors can be arbitrary chosen up to scaling, and that can also change the norm. Almost everything is floating in this norm. That's not good.

  • mexCallMatlab, error: JVM not running
    Hello,
    I have an instance of mexCallMATLAB() that *sometimes* throws an error with the message: "JVM not running", and I can't quite figure it out.
    I'm writing a c++ mex file that uses the open-source portaudio library to access my soundcard. When the read buffer is full, it calls a callback function, which is where I want to use mexCallMATLAB to export the data so I can process it using m-files. For the moment, I set up a simple test where the callback function calls an m-file that does nothing more than increment a global counter:

  • Re: Finding the nearest matrix with real eigenvalues
    =======
    In that case, it minimizes Dist(A,B) = norm(inv(V)*(A-B)*V,'fro')

  • Good way to compare two cell arrays???
    Hello,
    Your advice is needed to help figure out an eloquent solution to compare two cell arrays (that contain strings). The first cell array (files) needs to be shrunk down whenever it exists in the second array (finishedfiles). The final shrunken down array is called newfiles. Is there a better way to do this???

  • Re: Finding the nearest matrix with real eigenvalues
    ============
    And that's possibly because it's numerically unstable. But anyway, any similarity transform which exposes the eigenvalues as entries of the matrix could be the basis for this approach.

  • Load variable from java InputStream
    I'm picking out a single file from a zip file and creating a java InputStream which points to it using the following code:
    PathName = 'somepath';
    FileName = 'someZipFile';
    % Open the zip file
    zipJavaFile = java.io.File(strcat(PathName,F ileName));
    zipFile = org.apache.tools.zip.ZipFile(z ipJavaFile);

  • Re: Digital Signal on plot
    I'm not sure why this thread was revived, but since it was... None of this stuff is necessary at all. Use stairs().
    "Stairstep plots are useful for drawing time history plots of zero-order-hold digital sampled-data systems."

  • Re: Problem with .csvread
    Why are you using all these evals? Very unnecessary, and probably the source of the problem (I'm guessing the file name being passed to csvread is probably not what you think it is). The following should be identical to your code, except I added a check for file existence:
    for n = 1:m
    time_value(n) = (n - 1)*300;

  • Re: Capacity of a listbox
    Dear Kyung Ho Park,
    No, a listbox can carry more than 27 strings. Just try it:
    C = cell(1, 32);
    for iC = 1:32
    C{iC} = sprintf('line %d', iC);
    end
    uicontrol('style', 'listbox', 'string', C);
    Therefore I conclude, that another mistake causes, that you see too few strings.
    Jan

  • Loading & altering .avi file into Matlab
    Hi,
    I am new to Matlab and have been struggling for the last several days to load a movie into Matlab 2010a (Mac OSX) in order to convert it to grayscale and resize it.
    I attempted to import the .avi file into Matlab, using: a = mmreader('filename.avi'). This seemed to work as the basic file data was displayed (e.g., number of frames, pixel w x h).

  • Capacity of a listbox
    Hi,
    Does anyone now if there is a limitation in the number of strings a listbox can hold?
    I tried putting in 28 strings, but noticed that only 27 were displayed.
    My strings are about 20 characters or so each.
    Is this (small) capacity correct? If it is, too bad...

  • Re: Orientation of an animal's head
    Sorry, didn't know that img sharing is so easy nowadays.
    [link]
    I know you said more than 2 or 3, but these are the first two I could grab. One shows the normal video feed and the other shows the segmented rat. Ignore the accidental segmentation of the rat's reflection, today I'm using a temporary box that is unfortunately very glossy.

  • How to Include a library in a compiled program
    I'm trying to make a compiled matlab program using the deploytool function call however the program uses functions calls to image library created by the company I work at. How would I incorporate these libraries and function calls into the compiled program?
    Thanks!

  • Re: Finding the nearest matrix with real eigenvalues
    Just thought I'd point out that this is a non-differentiable constraint, so there are certain risks using fmincon. Perhaps only on a set of measure zero, though...
    Also, even though Gary has a solution he's happy with, I'll just throw out one more idea. If A is the given matrix with Jordan decomposition

  • Re: How does the Manual Switch block work?
    Reading through manswitch (I didn't realize edit could open built in functions, but I guess it just grabs things out of the search path) I can understand the steps it's taking. I don't mean to imply the Mathworks should have detailed helpfiles on helper functions, I just wanted to point out that I did try to RTM before posting :]

  • Re: Orientation of an animal's head
    Post some sample images (more than just 2 or 3) to [link].

  • Orientation of an animal's head
    I'm creating tracking software for animal behavior studies using a camera overhead an arena. I can segment the animal almost perfectly, but I need to know which direction its head is pointing. I can't segment the head by itself (unless someone knows how), but I do know that the head is very triangular with respect to the rest of the segmented image. I'm also doing this real-time off a video feed, so faster is better.

  • Re: textscan
    str2num() uses eval() to evaluate the string. That is relatively slow and is a
    security risk. str2double() or one of the formatted input routines such as
    sscanf() or textscan() are safer and potentially much faster.

  • Re: MATLAB bitplane extraction problem
    I think you can avoid use strings entirely. See the function bitget, which if I've understood you correctly, will do all the work for you, with one function call for each plane.

  • Re: MATLAB bitplane extraction problem
    No.
    If you subtract '0' (the quoted character of the digit 0) from your string
    array, you will get a 84228 x 8 numeric array. You can then reshape that to be
    448 x 188 x 8 .
    After the transformation I described above,
    matrix1 = TheNumericMatrix(:,:,1);
    matrix2 = TheNumericMatrix(:,:,2);
    and so on.

  • MATLAB bitplane extraction problem
    Hi guys,
    Currently I'm doing a project about bit plane extraction and I'm told
    to display all 8-bit plane images from a given gray scale image. I'm
    given a [448 x 188] matrix with values from 0 to 255.
    I want to convert the decimal to an 8 bit binary, so that if the
    number is 255 I get 11111111 and so on. I did that using binary =

  • Re: Sorting objects on a tranportation belt with object recognition
    Using a USB to serial adapter is _part_ of the problem but not all of it.
    The stop character that the micro-controller sends to the PC: is it a single
    character (or string of known length), or is it that followed by a line
    terminator? If it is _not_ followed by the same line terminator as you have

  • Re: local equalization
    Awesome, thank you!

  • Re: Digital Signal on plot
    Why all this complication???? There is a very simple trick to plot such a digital waveform in Matlab:
    %Generate random binary data
    N = 100; %number of binary values
    a = 2*(randi(2,N,1)-1)-1; %polar sequence of -1/+1
    %Plot preparation
    c = (a*[1 1]).'; %repeat each data bit

  • Re: Sorting objects on a tranportation belt with object recognition
    Shouldn't be too difficult, as long as your objects don't overlap. In
    fact if they are all the same size, you could just check the area of
    the objects and might not need anything else. For example if all your
    round objects are about 10 cm^2 and all your square objects are about
    40 cm^2, just check the area of each blob to find out if it's closer

  • Re: textscan
    thanks exosceleton, thats perfect!

  • Re: textscan
    sometimes, telling that one function is not capable of doing something also leads to the solution, i use now:
    oldstring=('1,500')
    modstring=strrep(oldstring, ',' , '')
    number=str2num(modstring)
    thanks!

  • Re: bitmap pixels from MATLAB to C
    Is that "24 bit" 3 channels of 8 bits each, or is it 24 bits for each of 3
    channels?
    The information for each of the three channels for 1 pixel is not located near
    the information for the other channels in memory: all of the information for
    one channel appears, then all for the next channel, and so on. reshape() thus

  • Isentropic expansion process in steam engine
    I am trying to simulate a steam engine cycle and currenlty I am only trying to simulate the isentropic process of the steam engine (isentropic expansion) on a T-S diagram which is a striaght vertical line , I am using a piston cylinder-crankslider mehcanism that moves with the insert of the steam at high temperature and pressure as inital conditions at some inital volume and the crank slider will move a 180 degrees when the piston moves from TDC to BDC, I have designed the crankslider mehcanism on simulink and it is working fine but when i attach the thermodynamic blocks into the system i dont get any realistic results and only errors and inncorrect diagrams,

  • Re: textscan
    How about this one:
    number=textscan(strrep('(1,500 )',',',''),'(%f)')

  • Sorting objects on a tranportation belt with object recognition
    Hello to eveybody.
    I have an interesting project to do at my University.
    A transportation belt with a web camera up from it. The task is to recognize the comming object: round, square or other.
    An IR barrier detects the overcomming object, the microcontroller stops the belt and sends a stop caracter to the PC (USB to serial adapter).

  • Re: textscan
    Sorry, Matlab does not support any way to do that in textscan() in a single
    step. If you have a file that uses comma as the decimal grouping character
    then it is recommended that you pre-process the file to remove the commas
    before attempting to parse the file.

  • bitmap pixels from MATLAB to C
    Hi
    I would like to know the difference between and how to transfer pixel data of a 24 bit bmp from imread and to a shared C library function that expects pixel data. I have tried reshaping the array returned from imread and flattening out the 3 dimensions using typecast to int32 but I still do not get an image in the C function, just coloured lines.

  • Re: Matlab Compiler
    ===========
    As I recall, the package .exe contains both MCR.exe (because you chose to add it) and the application .exe . When you execute the package .exe, it will unpack both of these.

  • textscan
    Hello!
    i want textscan to recognise my string '(1,500)' as the number 1500
    i dont really know how to get rid of the brackets and the comma
    number=textscan('(1,500)',??)
    any ideas?
    Roland

  • Matlab Compiler
    I'm trying to make my program as a stand-alone executable using the Matlab Compiler. I realize that any PC I use to run the file must have the MCR installed on it. When i click "Add MCR" when building the project, it adds a file called MCRInstaller.exe, but i cant find it in the project folder once the build is complete. What am i doing wrong? How can i install this file on other computers if i cant find it?

  • Re: How to I get Matlab to release the DLL?
    It's not a graceful solution, it's more like an 800 pound gorilla
    coming in and prying that creep's hands off your sister, but there's
    Unlocker.
    [link]
    It will pry MATLAB's hands off your file, but there's no guarantee how
    MATLAB will behave after that. It may be fine or it may have

  • Re: Launching non-blocking MATLAB scripts on a linux server from MATLAB on Windows
    I think your four instances of double-quote " are nesting in a way other
    than what you want. You might want to replace one pair of them with two
    single quotes each, which will result in one single quote being included in
    the string.
    str = 'That''s all folks!'