creating a graph on matlab - using the graph function - matlab

I am trying to create a graph in matlab, not a plot of some function but an actual graph with vertex and edges, the thing is that it won't let me create a graph according to the examples.
what am I doing wrong? is there any library I need to install or something?
when I try this code:
G1 := Graph([1,a,3], [[1,a],[1,3]]):
Graph::printGraphInformation(G1)
its from the documentation, it gives me this error:
Undefined function 'G1' for input arguments of type 'char'.

Related

MATLAB - build a graph without knowing the actual value of x

I have the following task to be completed in Matlab:
build graphic of the following function
x+sin(3x)/(x^2+1)
How can I build a graph without knowing the actual value of x?
You can use ezplot to do this:
ezplot('x+sin(3.*x)/(x^2+1)')

Error in using detectMSERFeatures function of Matlab

I am using detectMSERFeatures function of Matlab 2014b version, for getting an image's features but this function is giving an error, please help.
Code:
colorImage = imread('handicapSign.jpg');
I = rgb2gray(colorImage);
% Detect MSER regions.
[mserRegions, mserConnComp] = detectMSERFeatures(I, ...
'RegionAreaRange',[200 8000],'ThresholdDelta',4);
figure
imshow(I)
Error:
Error using detectMSERFeatures
Too many output arguments, please help.
detectMSERFeatures returns the second output MSER regions in a connected component structure starting from 16a. Before that, it returned only one output regions which is a MSERRegions object. You need to update your code to get only one output from detectMSERFeatures. Depending on what you need to do after detectMSERFeatures you can use extractFeatures function to extract feature vectors with the output from detectMSERFeatures. Checkout the documentation for R2014b, for examples.

get value from stem graphic

let us suppose that we have following graph of singular value distribution
which was given by following command
stem(SV)
SV_singular values,from visually of course we can find approximate values of singular values,but is there any possibility to get values from graph itself?of course someone may say that if we have SV,we can directly access,but i want just graphicl tool to get it from picture itself,for example like this
b=stem(SV);
but when i type b,i am getting following number
b
b =
174.0051
it is matlab self learning,so please help me to learn how to find values from graphics in matlab
The value stored in your variable b is a handle to the current axes. You can access the properties of this axes using get. To access the values in the plot, you can use
b=stem(SV);
values = get(b, 'ydata');

How to use dct2() in matlab?

I am trying to pass a matrix to dct2 function but it is showing error. I am using matlab version R2012a. I have a matrix B which just used as argument like below
B = dct2(A);
disp(B);
Error is showing like this
Undefined function 'dct2' for input arguments of type 'uint8'.
Error in image_dct (line 24)
B = dct2(A);
You have to have the image processing toolkit in order to use that. Assuming you have that, then it should be just as simple as you listed.

which format can I give to imstack2vectors Matlab function?

So I have imported RGB photo into my Matlab workspace. It says it has value: <200x200x3 uint8>. Meaning it has class uint8. And its name is: prettyPic. So when I try to do the following:
% Convert prettyPic to vector format using function imstack2vectors.
[prettyPic, L] = imstack2vectors(prettyPic);
I get the following error:
??? Undefined function or method 'imstack2vectors' for input
arguments of type 'uint8'.
I was searching google all around reading the Matlab help and even trying to give 'imstack2vectors' different types of variables only to find that none works.
So the question is what type of picture should I feed the 'imstack2vectors' with. And how can I convert the picture that I have to that format/class.
I am a begginer in Matlab so any help would be greatly appreciated!
??? Undefined function or method 'imstack2vectors' for input arguments of type 'uint8'.
Means that most likely, the function imstack2vectors does not exist on your Matlab path (i.e Matlab cannot find a function of this name).
Type which imstack2vectors to see whether Matlab can find it on the path. If it returns nothing, but you know where the function is on your hard drive, you can change directories in Matlab to where the function is located, and then run your command again.
In general, you may want to learn about adding functions to the Matlab path.