For a homework assignment in linear algebra, I have solved the following equation using MATLAB's \ operator (which is the recommended way of doing it):
A = [0.2 0.25; 0.4 0.5; 0.4 0.25];
y = [0.9 1.7 1.2]';
x = A \ y
which produces the following answer:
x =
1.7000
2.0800
For the next part of assignment, I'm supposed to solve the ...
I have two waveforms in the time domain, of which I need to measure the cross-correlation coefficient in MATLAB. I have tried max(abs(xcorr(m,n,'coeff'))) but it doesn't seem to be working properly.
Also I need to measure the cross correlation coefficient for different sections of the waveform, e.g. measure the cross correlation coeffic...
Hello, I am trying to write a function that returns a one dimentional gauss filter. the function took sigma as a parameter. The problem is that the function returns the same array for all sigmas.
function gaussFilter=gauss(sigma)
width = 3 * sigma;
support = (-width :sigma: width);
gaussFilter= exp( - (support).^2 / (2*sig...
I have a polyhedron, with a list of vertices (v) and surfaces (s). How do I break this polyhedron into a series of tetrahedra?
I would particularly like to know if there are any built-in MATLAB commands for this.
...
Hey Folks,
Let me start by saying I LOVE YOU. Thank you.
Next order of business:
octave-3.2.3:8> xin = imread('3Phone.png');
octave-3.2.3:9> colormap(gray(256));
octave-3.2.3:10> image(xin);
error: invalid value for array property "cdata"
error: set: expecting argument 2 to be a property name
error: set: expecting argument 4 to be a p...
We all know MATLAB provides tab-completion for filenames used as arguments in MATLAB function like importdata,imread. How do we do that for the functions we create?
EDIT:
Displays the files and folders in the current directory.
...
If i have a matrix A with n values spanning from 65:90. How do i get the 10 most common values in A? I want the result to be a 10x2 matrix B with the 10 common values in the first column and the times it appears in the second column.
...
I'd like to show an image and plot something on it and then save it as an image with the same size as the original one. My MATLAB code is:
figH = figure('visible','off');
imshow(I);
hold on;
% plot something
saveas(figH,'1','jpg');
close(figH);
But the resulting image "1.jpg" has saved non-image areas in the plot as well as the image....
Let's say I want to take the sin of 1 through 100 (in degrees).
I come from a C background so my instinct is to loop 1 through 100 in a for loop (something I can do in Matlab). In a matrix/vector/array I would store sin(x) where x is the counter of the for loop.
I cannot figure out how to do this in Matlab. Do I create a array like
...
Hey everybody
I'm stuck with a basic problem in my MPEG-1 compression. I have to produce macroblocks within a image. A macroblock consists of 16 x 16 pixels - where 4 x 8x8 is luminance, 1 x 8x8 is Cb and 1 x 8x8 Cr. In MATLAB I want to produce a cell matrix containing this. Any suggestions?
...
I'd like to know if there's a way that when using Matlab, instead of having it interpret what I write line by line, if allows me to write all I want, and only interpret it when I hit an "Evaluate" button, or something like that. Coming from c++/c# I like to write the code I have to, and only then run it.
Also I don't like it putting >>'...
Hi,
I am ssh connecting to a linux server and do some Matlab programming. I would like to save invisible plot as
figH = figure('visible','off') ;
% Plot something
% save the plot as an image with same size as the plot
close(figH) ;
saveas() and print() will change the size of the saved image different than the size of plot. Als...
matlab is acting weird. if I assign the value 202 to variable a and 207 to variable b then add a+b it gives me the correct answer 409. Now if I subtract a-b it gives me 0 instead of -5.
btu if I do 202-207(not using the variables a and b ) it gives me -5.
what could be causing this?
edit: it gets even weird. I just noticed that matlab ...
How do I make an array that's defined with a start point, an end point, and a total array size? Something like an array that goes from 1 to 10 that's 20 elements long. For example, the array could look something like:
1 1.5 2 2.5 3 3.5 ...
...
I use this code to create and plot N points:
N=input('No. of Nodes:');
data = rand(N,2) % Randomly generated n no. of nodes
x = data(:,1);
y = data(:,2);
plot(x,y,'*');
How do I choose k points (with probability p=0.25) out of N points, then color those k points red and leave the other points as *.
...
I have an image in MATLAB:
y = rgb2gray(imread('some_image_file.jpg'));
and I want to do some processing on it:
pic = some_processing(y);
and find the local maxima of the output. That is, all the points in y that are greater than all of their neighbors.
I can't seem to find a MATLAB function to do that nicely. The best I can come ...
I have a set of points
1 1
2 5
3 10
4 20
... ...
How can I plot this in a graphic in matlab? When I try to select in the workspace the my "points" variable and hit "plot" in the menu, it will plot the first column as blue and the second one as green. I believe it considers both columns as different functions, and that is not what I w...
Hi
It seems to me that there are two ways to run Matlab in batch mode:
the first one:
unset DISPLAY
matlab > matlab.out 2>&1 << EOF
plot(1:10)
print file
exit
EOF
The second one uses option "-r MATLAB_command":
matlab -nojvm -nosplash -r MyCommand
Are these two equivalent?
What does "<< EOF" and the last "EOF" mean in...
I have the following code to plot one graphic:
plot(softmax(:,1), softmax(:,2), 'b.')
and then this one to plot another:
plot(softmaxretro(:,1), softmaxretro(:,2), 'r.')
Now I'd like to be able to plot both ones in the same place. How can I accomplish that?
...
I have an image in MATLAB:
im = rgb2gray(imread('some_image.jpg');
% normalize the image to be between 0 and 1
im = im/max(max(im));
And I've done some processing that resulted in a number of points that I want to highlight:
points = some_processing(im);
Where points is a matrix the same size as im with ones in the interesting poin...