This question already has an answer here:
Draw network or graph from matrix in matlab
(1 answer)
Closed 7 years ago.
I have an adjacency matrix and corresponding labels. I need to plot a network with weighted edges and different colors based on labels. I found there is gplot function in matlab, but it is not created weighted edges. Does anyone know any toolbox or function or something I can use?
There is a tool called wgPlot by Mike Wu that will allow you to plot weighted adjacency graphs easily.
wgPlot by MikeWu
Note that the edges are not labeled textually, but by a color scale.
Related
This question already has an answer here:
Bilinear image interpolation / scaling - A calculation example
(1 answer)
Closed 6 years ago.
I have (x,y) points and how to find (x1,y1),(x1,y2),(x2,y1),(x2,y2) grid points in the set of data points(xi,yi)...
Have a look at ceil and floor.
They will round up and down a value, thus ceil(3.2) will output 4 and floor(3.2) will output 3. The right combinations of ceil/floor x and y will give all the points you need.
This question already has answers here:
Save a plot in Matlab as a matrix [duplicate]
(2 answers)
Closed 6 years ago.
I wish to save a plot created in octave in a matrix
x=[0:10];
y=[0:10];
figure(1);
plot(x,y);
How can I save this plot into a matrix (or a 3D array, assuming it is RGB). To explain in a different way. Lets say there exist an image "img.jpg" in the working directory. Than i can open it as a matrix
A=imread("img.jpg");
How can one accomplish the same, having the plot saved in the matrix A?
Did you mean loading an image stored as a matrix into a variable? If so, You can use
A = load('img.mat')
This question already has an answer here:
3d plot with given 2d data
(1 answer)
Closed 8 years ago.
There are 2D experimental data.
z=load('data.txt');
x=z(:,1);
y=z(:,2);
plot(x,y)][1]
I want to make it to 3D as the link did.
Here is a link. 3d plot with given 2d data
The question and answer is a bit misleading, since the question is actually not regarding data but the bell function (or triangular function). They are symmetric and have corresponding 2D versions (see: http://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function).
y=exp(-x.^2/2); %1D
z=exp(-(X.^2+Y.^2)/2); %2D
In general, however, this is not the case. Your data, for instance, is not 2D:
z=load('data.txt');
x=z(:,1);
y=z(:,2);
x is 1D and y is your dependent variable. If x and y were independent you would have a third variable (e.g. z):
x=[0,1,2];
y=[0,1,2];
z=[1,2,3;
2,2,2;
3,2,1];
The entries in z would then be z(x,y) (e.g. z(3,3)=1).
To sum up the confusion:
When you plot a 1D function it is plotted in 2D (x,y),
and when you plot a 2D function it is plotted in 3D (x,y,z), (x,y,colors) or (x,y,z and colors) (the latter is what is used in the mentioned question).
This question already has an answer here:
Centering histogram bins and setting percentage range in Matlab
(1 answer)
Closed 9 years ago.
I have a big matrix with thousands of values. I want to make a histogram of each signal. This is easily done with MALTAB's commands. My problem is I want it normalised in the sense that the y-axis is 0-1 and not 0-(the number of measurements). Any smart way to do this?
Use histc()
counts = histc(data);
normCounts = counts/sum(counts);
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Matlab 3D Matrix Plot
I have a matrix in matlab that I want to plot as a 3D figure.
Suppose the matrix looks like the following:
A=[4 7 8; 2 3 9 ]
This actually means the following data points in x,y,z plane
(1,1,4) (1,2,7) (1,3,8) (2,1,2) (2,2,3) (2,3,9)
I want to plot these values on a 3D graph.
How can I do that?
The function to use is surf(A)
This will plot your points from x = 1:2 and y = 1:3