- If h is a function, then invoke the function passing in the two variables x and y. If h is an array instead of a function, then if any values in "x" or "y" are not positive integers, give an error; otherwise look in the array "h" at row #x column #y and retrieve the values there. In the array case, retrieve the combination of each value in x with every value in y, so h([1 2], [3 4 5]) would be h(1,3), h(1,4), h(1,5), h(2,3), h(2,4), h(2,5)
- multiply the constant 2 and the constant Pi
- if Wx is a scalar or vector or array, retrieve all of it. If Wx is a function, then call Wx passing in now arguments, and retrieve the result
- Multiply the result calculated in #3 by the constants calculated in #2; the result will be the same size as whatever was calculated in #3
- raise "e" to the exponents calculated by #4, resulting in something the same size as #4 (which in turn would be the same size as whatever Wx was)
- If either #1 or #5 resulted in scalars, then multiply all the elements of the other by the scalar and do not do anything further in this step. Otherwise, if #5 needs more than 2 dimensions to represent, give an error: matrix multiplication is not defined for more than 2 dimensions. Otherwise, compare the number of columns of the result of #1 to the number of rows of the result of #5, and if they are not equal, give an error: matrix multiplication is only defined if the "inner dimensions" match. If both checks are okay, then do an algebraic matrix multiplication (inner product) of the result of #1 with the result of #5, resulting in something that has the same number of rows as #1 and the same number of columns as #5
- if g is a function, then give an error: results can only be assigned to arrays. If g is a numeric matrix and #6 has any symbolic components then attempt to convert the contents of #6 to pure numeric form, failing if the contents of #6 involves any unresolved symbolic variables. If g is a numeric matrix with a different datatype than the contents of #6, convert the contents of #6 to the datatype that is already being used by g. If g does not exist then use the contents of #6 unchanged
- if any values in "x" or "y" are not positive integers, give an error: matrices cannot be indexed at 0 or negative or fractions. Otherwise if g is an existing matrix which is smaller than max(x) by max(y) then extend g to have at least max(x) rows and max(y) columns by filling g with 0 in all extension locations. Otherwise if g does not already exist then create it to have max(x) rows by max(y) columns, each filled with zeros of the same datatype as #7
- copy each value in #7 to the corresponding location in the array g as per #8
- Do not display the content of g after the assignment, because the semi-colon at the end indicates that it should not be printed. If the semi-colon were not there, then the contents of g after the previous operations would have to be formatted and displayed to the command window.
g(x,y)=h(x,y)*exp(2*pi*Wx); what does this expresion means?
1 view (last 30 days)
Show older comments
what does the expression means.basically what does the expression g(x,y) means ? here h(x,y)is a 2dimoensional guassian function .can any you help me in getting the code for matlab ?
0 Comments
Accepted Answer
Walter Roberson
on 1 Feb 2014
Chances are that what you are looking at is a mathematical formula rather than some MATLAB code.
If it is intended to be MATLAB code, then it might be Symbolic Toolbox code.
If it is MATLAB code not intended to be Symbolic Toolbox code, then x and y would have to be nonnegative integer indices (but not necessarily scalars), and the code would read:
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!