matlab

MATLAB: How do I get 3D coordiantes from a user-click?

I'm using Matlab to create a small chess game for one of my courses this semester. The thing I'm having trouble with is having the user be able to select one of the chess pieces. To simplify things, I'm making it so that the user selects a piece by clicking on the square that the chess piece resides on rather than clicking the piece it...

Generating data on unlevel background

I want to make an unlevel background and then generate some test data on that using Matlab. I was not clear when I asked this question earlier. So for this simple example for i = 1:10 for j = 1:10 f(i,j)=X.^2 + Y.^2 end end where X and Y have been already defined, it plots it on a flat surface. I don't want to distort the fu...

3D plotting in Matlab

I'm using the subplot and then surf functions to generate images in 3D in Matlab. How do I get rid of the axes and axis' gridlines and change the color to all yellow or all green or something like that? Thanks. ...

Built in colormaps in Matlab

I want a lighter version of the "cyan" color, using the function colormap('cyan'). How do you do this? ...

Evaluating and graphing functions in MATLAB

I am trying to graph the following Gaussian function in MATLAB (should graph in 3 dimensions) but I am making some mistakes somewhere. What is wrong? sigma = 1 for i = 1:20 for j = 1:20 z(i,j) = (1/(2*pi*sigma^2))*exp(-(i^2+j^2)/(2*sigma^2)); end end surf(z) ...

Special functions in Matlab

I'm trying to get a picture like the following: http://upload.wikimedia.org/wikipedia/en/e/e6/Airy-3d.svg What am I doing wrong? [x,y]=meshgrid(-1:.1:1,-1:.1:1); surf(x,y,(2*besselj(1,2*pi*sqrt(x.^2+ y.^2)/sqrt(x.^2+ y.^2)).^2) Also... kind of a side note, but if I used ndgrid instead of meshgrid here my x's and y's would switch rig...

Monochromatic colors in Matlab

In Matlab how can I make a function monochromatic orange (like the kind where it says "Ask Question" on the right side of the screen) ? ...

Plotting data with meshgrid

When you use meshgrid to plot data (using meshgrid itself not one of the other plotting functions), how do you change the color to grayscale or black and white? Also, how do you get rid of the "meshy" look of the image? ...

Graphing special functions in Matlab (2D Bessel)

I'm trying to essentially get something like this where I can see clear ripples at the base but otherwise it's like a Gaussian: This is kind of unsatisfactory because the ripples aren't very noticeable, it has a very gritty quality that obscures the image a bit, and if you move the graph so that it's just in 2D (so it looks like a cir...

matlab precision determinant problem

I have the following program format compact; format short g; clear; clc; L = 140; J = 77; Jm = 10540; G = 0.8*10^8; d = L/3; for i=1:500000 omegan=1.+0.0001*i; a(1,1) = ((omegan^2)*(Jm/(G*J))*d^2)-2; a(1,2) = 2; a(1,3) = 0; a(1,4) = 0; a(2,1) = 1; a(2,2) = ((omegan^2)*(Jm/(G*J))*d^2)-2; a(2,3) = 1; a(2,4) = 0; a(3,1) = 0; a(3,2...

Forming vectors from the same assigned value (in Matlab)

I've got a bunch of values that are all assigned the same variable due to running through a for loop several times, so for example: d = 3.44434 d = 2.4444 d = 2.7777 How do I put them all into a vector? ...

Using Cepstrum for PDA

Hey, I am currently deleveloping a algorithm to decide wheather or not a frame is voiced or unvoiced. I am trying to use the Cepstrum to discriminate between these two situations. I use MATLAB for my implementation. I have some problems, saying something generally about the frame, but my currently implementation looks like (I'm award of...

Why is this class re-initialized every time?

I have 4 files and the code 'works' as expected. I try to clean everything up, place code into functions, etc... and everything looks fine... and it doesn't work. Can somebody please explain why MatLab is so quirky... or am I just stupid? Normally, I type terminator = simulation(100,20,0,0,0,1); terminator.animate(); and it shou...

How do I change the Unit:Characters in Matlab?

For portability, I set the units of my GUIs to 'characters'. Now I have a user who wants to use Matlab on his netbook, and the GUI window is larger than the screen (and thus cropped at the top). I think I could try and write something in the openingFcn of the GUI that measures screen size and then adjusts the GUI accordingly, but I'd r...

Error: Attempted to access data(2,:); index out of bounds because size(data)=[1,7129].

I have a microarray data of 38 row and 7130 columns. i am teying to read the data but keeping having the above error. I debugged and found when i read the data, i have a 1x7129 instead of a 38x7130. I don't know why. my 7130th column contains letters while the rest of the data are numbers. Any idea why this is happening? ...

SET game odds simulation (MATLAB)

I have recently found the great card came - SET. Briefly, there are 81 cards with the four features: symbol (oval, squiggle or diamond), color (red, purple or green), number (one, two or three) and shading (solid, striped or open). The task is to locate (from selected 12 cards) a SET of 3 cards, in which each of the four features is eith...

Matlab- select data from a 3d plot

Hey, I have a 3d plot. I want to select a certain area in the plot and get the points within this area into a variable. Is that possible? Thanks, Li ...

How to prompt for input using an existing variable in the prompt.

I'm trying to ask the user for a value of some variable, but at the same time, showing him the last value used (at the termination of the program, the values are saved to a file, and loaded at the start of the program). Something like this: Enter new radius value (R=12.6) : ... user enters 12.7 ... Enter new pi value (pi=3.14) : Enter ...

Matlab Simulation: Point (symbol) Moving from start point to end point and back

Hi, I would like to create an animation to demonstrate LDPC coding which is based on Sum-Product Algorithm So far I have created a graph which shows the connections between symbol nodes (left) and parity nodes (right) and would like to animate points travelling from symbol to parity nodes and back. The figure is drawn by executing the...

Matlab: How to create a 3D matrix?

Hi, Does anyone know how to define a 3D matrix in matlab, for example a matrix of size (8 x 4 x 20) or add a 3rd dimension to an existing 2D matrix? Thank you. ...