my closed loop transfer function is:
H(s)=2exp(-q)/(1+exp(-2q))
q=sqrt((a+k sqrt(s)+s)*s) , s=sigma+jw
how can i draw root locus of H(s) as 'a' changes for different values of k?
i need a code for mathematica 9,i have examined some codes, but they didn't work.
Related
This question already has an answer here:
How to create an array according to row and column number [duplicate]
(1 answer)
Closed 5 years ago.
The problem is the following: I have a .txt file containing 3 columns of numbers. The first 2 columns are the coordinate x,y of the points. The third columnn (z vector) is made of numbers that express the luminosity of each point. (The .txt files have been generated by a software that is used to study the pictures of a combustion process). Each vector (x,y,z) is made of 316920 elements (all integer numbers). Now: is there a way to create from these 3 vectors an image in matlab relating the luminosity value to the coordiantes of the point?
Thanks for your time!
consider a file image.txt contains y x and intensity values separated line. like this.
1 1 0
1 2 12
1 3 10
....
....
255 255 0
open the text file using fopen function
fid = fopen(image.txt,'r');
im=[];
and read a string-line of characters by fgetl function, convert string-line into vector using sscanf and put intensity value into y and x coordinates of a image matrix, im.
tline=fgetl(fid) ;
rd=sscanf(tline,'%d');
im(rd(1),rd(2))=rd(3);
The same process is iterated up-to end of file.
at last close file-handle fid
I am going to assume that the three columns in your text file are comma separated( The code will need to be a bit different if they are not comma separated) . Since you said all numbers are integers, I am going to assume that you have all the data needed to fill a 2D grid using your x and y coloumns is present. I am not assuming that it is in a ordered form. With these assumptions the code will look like
data = csvread(filename)
for i=1:length(data)
matrix(data(i,2)+1,data(i,1)+1)=data(i,3) // +1 is added since there maybe a index starting from 0 and matlab needs them to start from 1
end
image(matrix)
For other delimiters use
data = dlmread(filename,delimiter)
I am reading a article about pattern reconigation. I am not understanding how this 8 column coming from. and how its output is generating.
I tried to get the concept but i am not getting how first matrix have 8 column ? and how its calculating output ?
The network of figure 1 is trained to recognise the patterns T and H.
The associated patterns are all black and all white respectively as
shown below.
If we represent black squares with 0 and white squares with 1 then the
truth tables for the 3 neurones after generalisation are;
enter image description here
Each table represents one line of you image.
Each column(Xij) of your table represents possible combinations of those pixels in one line(of your input image) and OUT represents if those combinations evaluate to true or false.
There are 8 columns because there are 8 possibilities of combining 3 values of 1 and 0 (2 at the power of 3).
I think it's easier if you look at those tables on vertical(transpose).
How do I import a matrix into Matlab and then visualize it as a surface?
I want to have it something like this at the end:
http://www.mathworks.se/help/matlab/ref/meshgrid.html
to be able to do that I have to first have it as an input of the meshgrid(according to the file) but I have no idea how to do that.
enter link description here
I am completely new in Matlab...
Thanks in advance
The are many possibilities (file formats, visualisation functions, etc) depending on what you would like to achieve. The simplest example I can think of is as follows.
Suppose you have a file named data.txt in your working directory that contains
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Then the commands
M = load('data.txt');
surf(M)
xlabel('x')
ylabel('y')
title('Matrix M')
will give you the following plot
Since the matrix M is not a square matrix, you can see in the plot which dimension is assigned to each axis.
To change the viewpoint you can use the view command. All there is to this command is summarised in this picture
taken from here http://www.mathworks.com/help/matlab/visualize/setting-the-viewpoint-with-azimuth-and-elevation.html
The first argument to be passed to the view command is the azimuth and the second argument is the elevation, as defined in the picture above.
For example, if you want to make the order of the values on the x and y axes appear reversed, you can first read the current azimuth and elevation
% get from current axes the attribute View
current_view = get(gca,'View');
and change it with view(current_view + [180 0]). The result is
You can also rotate a plot interactively: on the toolbar of the Figure window there is a circular arrow. You can click on it to activate it and then click and drag inside the window.
Dear stackoverflowers.
So, let's say there's a grid, whose values at certain x and y represent whether there is a tile there (1) or it's missing (0).
For example,
100110100010
100100111110
111110000000
000010000000
And there are some already known shapes A, B and C, for example,
(A) (B) (C)
1 1 1
111, 111, 11
So what I am trying to achieve is to identify which 1's on a grid belong to which shape.
All of 1's should be used up, exact number of shapes is known, but rotation (no mirroring) is allowed, so I guess it's better to add rotated versions and think, that some shapes won't be found on grid.
So, the expected result would be (it's known that it should be exactly 1xA, 2xB, 2xC):
A00CC0B000C0
A00C00BBBCC0
AABBB0000000
0000B0000000
If there are several possible matches, any would suit, as long as every tile gets allocated to it's own shape.
Moreover, finding out whether a tile is present or not ("uncovering") is an expensive operation (but results are cached, tiles don't appear out of nowhere), so I am actually seeking for a way to identify them with as minimum number of "uncoverings" as possible.
(It's okay if it's not optimum, just identifying shapes would be great).
Obviously, set of known shapes might change (but it will be known by the time of implementing and it will stay constant, so it's possible to tune up code for a particular set of tiles or develop some search strategies), but it won't be large (~5-6) and grid is quite small too (~15x15).
Thanks!
Using the ideas here and/or here (I guess using this one, the object types would be 0 and 1), one way to do it might be to try and match your own patterns against the catalog of collected objects. To take you own example,
100110100010
100100111110
111110000000
000010000000
Shapes A, B and C:
(A) (B) (C)
1 1 1 111 1 11
111 or 1 111 or 1 11 or 1
11
The first collected object might be,
1 11
1 1
11111
1
=> represented as a set of numbers: [(0,0),(0,1),(0,2),(1,2)..etc]
(the objects need not start or include (0,0) but object
bounds seem needed to calibrate the pattern matching)
Testing object A against the top left of the object would match [(0,0),(0,1),(0,2),(1,2)]. After A is matched, the program must find a way to calibrate the remaining points - the bottom right corner will effectively be measured as (2,3) rather than (4,3) - testing the bottom right of the remaining points in the object would match object B. Continue in a similar vein to match all, trying different combinations if a total match is not found.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Detecting thin lines in blurry image
So as the title says, I am trying to detect boundaries of patterns. In the images attached, you can basically see three different patterns.
Close stripe lines
One thick L shaped line
The area between 1 & 2
I am trying to separate these three, in say 3 separate images. Depend on where the answers go, I will upload more images if needed. Both idea or code will be helpful.
You can solve (for some values of "solve") this problem using morphology. First, to make the image more uniform, remove irrelevant minima. One way to do this is using the h-dome transform for regional minima, which suppresses minima of height < h. Now, we want to join the thin lines. That is accomplished by a morphological opening with a horizontal line of length l. If the lines were merged, then the regional minima of the current image is the background. So we can fill holes to obtain the relevant components. The following code summarizes these tasks:
f = rgb2gray(imread('http://i.stack.imgur.com/02X9Z.jpg'));
hm = imhmin(f, h);
o = imopen(hm, strel('line', l, 0));
result = imfill(~imregionalmin(o), 'holes');
Now, you need to determine h and l. The parameter h is expected to be easier since it is not related to the scale of the input, and in your example, values in the range [10, 30] work fine. To determine l maybe a granulometry analysis could help. Another way is to check if the result contains two significant connected components, corresponding to the bigger L shape and the region of the thin lines. There is no need to increase l one by one, you could perform something that resembles a binary search.
Here are the hm, o and result images with h = 30 and l = 15 (l in [13, 19] works equally good here). This approach gives flexibility on parameter choosing, making it easier to pick/find good values.
To calculate the area in the space between the two largest components, we could merge them and simply count the black pixels inside the new connected component.
You can pass a window (10x10 pixels?) and collect features for that window. The features could be something as simple as the cumulative gradients (edges) within that window. This would distinguish the various areas as long as the window is big enough.
Then using each window as a data point, you can do some clustering, or if the patterns don't vary that much you can do some simple thresholds to determine which data points belong to which patterns (the larger gradient sums belong to the small lines: more edges, while the smallest gradient sums belong to the thickest lines: only one edge, and those in between belong to the other "in-between" pattern .
Once you have this classification, you can create separate images if need be.
Just throwing out ideas. You can binarize the image and do connected component labelling. Then perform some analysis on the connected components such as width to discriminate between the regions.