Converting Equation of Two Variables Into Matrix Elements – ERROR: Operator ‘*’ is not supported for operands of type ‘function_handle’.
Hello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.mHello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.m Hello everyone,
I am trying to output a square matrix that is N x M in size, where N = M. In my case, N = 3. So this is a "3×3" matrix
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be used as an "integration variable" as seen below.
I am trying to calculate an output called the "Z Matrix" which will integrate the "Kernal" variable across specific ranges.
I attached a .pdf file to clarify my end goal.
See the .pdf file attached:
Z_Matrix_Output.pdf
My Integration Limits for "z" will be going from:
z_start = 0 : L/N : (N-1) * (L/N)
z_end = L/N : L/N : L
As of right now, I’m getting the error:
Operator ‘*’ is not supported for operands of type ‘function_handle’.
This is after I tried using "function handles" in my code.
In my attempt, I have tried to use for loops and created function handles to make it easier to generate this matrix.However, I didn’t end up with a "N X M" matrix, I just ended up with a "1 X N" matrix.
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X M" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding converting equations of two variables into "matrix elements". However, I wasn’t able to find anything that was relevant to my case.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Z_Calculation.m matrix array, matrix, matrix manipulation, integration, numerical integration MATLAB Answers — New Questions