matlab

Acquiring coordinates readouts from an optical mouse ala wiimote (MATLAB code)

I plan to get the x-y coordinated reading from an optical mouse. Basically, I want the readout to be something like this but instead of using a Wiimote, I'll be using a standard USB mouse. I have found quite a good example - [http://www.synbio.org.uk/component/content/article/46-instrumentation-news/1234-interfacing-an-optical-mouse-sen...

Put text into non-active Axes in MATLAB

Most MATLAB plotting commands allow you to specify which axes to act on, for instance plot (x,y) plots in the current axes, but plot(Ax, x, y) will plot in the axes Ax. Similarly, you can label the x- or y- axis of a non-active axes xlabel(Ax, 'this label goes on the x-axis of Ax whether or not Ax == gca') But the text comman...

Matlab: extracting onsets in different files and saving them in different files

hello, I am a newby writing a script and I am facing what I think should not be difficutl to solve... this script is to: 1)extract 4 different fmri onsets from matlab files (the files are named 'subject 06 data', 'subject 05 data', etc...) 2)put this information in a new file with 2 other variables named 'durations' and 'names' 3)sav...

How i can draw a 3D vector with MATLAB and move it along a parabola?

My question is simply... I have the plot of one parabola. I made it using: t = -20:0.1:20; plot3(0,t,-t.^2); Now i want to plot one vector with the origin in some point [x0 y0 z0] and the end in one point of the parabola. After that, i want to move the end of the vector along the line that describe the parabola with the origin always...

In matlab, how do you save a figure as an image in the same way as using "Save As..." in the figure window??

Hey guys, Do you know what function the actual figure window uses when you go File>Save As... and then select .png or another image format?? Because I am trying to automate saving, but when I use saveas or print, the resulting image is really pixelated, but if I look at the actual figure, and use the File>Save As... method as above, and...

Matlab: Find the Range for Polynomial Equations

I have a polynomial, y(x)=a0+a1*x^1+a2*x^2+a3*x^3+a4*x^4+......+an*x^n. of the degree n, where ai is a real number. My question is, is there a function in matlab that I can use to find the range of x for all y(x)>0? ...

Matlab: Polynomial Expansion Routine

In Mathematica, it's easy to expand terms like (ax^2+bx+c)^n But is there anyway I can do this in Matlab? ...

Python function to solve Ax = b by back substitution.

Okay, for my numerical methods class I have the following question: Write a Python function to solve Ax = b by back substitution, where A is an upper triangular nonsingular matrix. MATLAB code for this is on page 190 which you can use as a pseudocode guide if you wish. The function should take as input A and b and return x. Your functio...

How to read from console in MATLAB?

How do I read a string or character from MATLAB console (command window)? ...

How read an analogue input in R? / or how to translate an existing Matlab code

I use a photoelectric cell to time an event in a response time experiment. It works well in Matlab, but I wanted to control it in R. Would any of you be able to help me translate the Matlab code to R? global AI ch0 AI = analoginput('nidaq', 1); AI.InputType = 'SingleEnded'; ch0 = addchannel(AI,0); Thanks! ...

How to describe a MATLAB function using mathematical notation?

Basically I have created two MATLAB functions which involve some basic signal processing and I need to describe how these functions work in a written report. It specifically requires me to describe the algorithms using mathematical notation. Maths really isn't my strong point at all, in fact I'm quite surprised I've even been able to de...

How to create functions and run them when using a GUI ?

Possible Duplicate: How can I program a GUI in MATLAB? Hi all .. I recently started using MATLAB after a long time and need help recalling how we used to create functions in MATLAB code when using a GUI. The end result I'm seeking is that I have the code behind a button click call another function, which takes in some input pa...

Equivolume financial chart in Matlab

Can't find anywhere a Matlab code to plot Equivolume bars, does anybody knows how to? http://www.armsinsider.com/education/armsonthemarket/equiv_chart.asp Thanks, Alberto ...

How i can draw a 3D vector with MATLAB and move it along a parabola?

I'm asking the same question of some days ago but now i would like to add at the question one more step. Below the code for the first step: t = -20:0.1:20; plot3(zeros(size(t)),t,-t.^2); hold on i = 1; h = plot3([0 0],[0 t(i)],[0 -t(i)^2],'r'); for(i=2:length(t)) set(h,'xdata',[0 0],'ydata',[0 t(i)],'zdata',[0 -t(i)^2]); pause...

MATLAB and .NET, System.Double gets displayed as integer

Hi, i successfully integrated my .NET Dll into MATLAB. Everything is good. But, i pass a System.Double with value like 6000.46, and return it in a MATLAB function as [valueFromDotNet] the ans of MATLAB is ans = 6000, but i expected at least ans = 6000.4600 has anybody an idea where i have to look? EDIT 1: I ensured that the format is s...

Pattern recognition applied to metallography using wavelet transform

Hi all, We have six standard patterns of graphite particles. We have to recognize these patterns from a sample image by using matlab. I am getting difficulty in how to recognize these different patterns of graphite in cast iron? Can you please help me write the code? ...

How to vectorize a random walk simulation in Matlab

I am rewriting a monte carlo simulation model in Matlab with an emphasis on readability. The model involves many particles (represented as (x,y,z)) following a random walk over a small set of states with certain termination probabilities. The information relevant for output is the number of particles that terminate in a given state. Th...

Contour plot a custom function

I have a custom function which returns either 0 or 1 depending on two given inputs. function val = myFunction(val1,val2) % logic to determine if val=1 or val=0 end How can I create a contour plot of the function over the x,y coordinates generated by the following meshgrid? meshgrid(0:.5:3,0:.5:3); This plot will just simply di...

Deblurring of motion blurred images

I'm looking at an interesting problem of deblurring motion blurred images. Rather than going for guesses of psf, I'm interested in finding out the actual blur parameters (angle and length). I was successful in finding angle of blur to a certain extent, and need a good technique for finding blur length. If any one has a good idea or code ...

Matlab: How to calculate how many unique strings are stored in the cell?

Hi, Given the cell with string values I would like to count how many different values are stored in it. The following ae the example values: A(1, 1) = 'DA4590162D037A78D96557AA886ADF9715B79C75'; A(2, 1) = 'AFAB19476C2CEEEE101FFA45FD207BA8B6185B29'; A(3, 1) = '99C1F96461BC870574D002034F001BA3F96A9AB5'; ... A(8, 1) = '99C1F96461BC870574D...