b1 =
Double integral of matrix
Show older comments
Hello all,
I need to take double integral of matrix with respect to dy and dy respectively. Also, my matrix consists of the multiplication of its transpose and own so, I got conj text instead of numerical value. Can you help me?
b1 =
[y - 2, 2 - y, y - 1, 1 - y]
[x - 3, 2 - x, x - 2, 3 - x]
b1'
[conj(y) - 2, conj(x) - 3]
[2 - conj(y), 2 - conj(x)]
[conj(y) - 1, conj(x) - 2]
[1 - conj(y), 3 - conj(x)]
I need to take following integral:

Thank you.
9 Comments
I faced a similar problem
I wanted to integrate B' * B * k (Was trying to do my FEA assignment)
But instead of B' replace it with transpose(B)
This way you won't get conjugate.
transpose(B)*B*k
I am still trying to double integrate the matrix, I cannot figure how to do it. If I find, I will reply to this message again.
[Edited]
I found how to take double integration of a matrix
b1_func = matlabFunction(b1) %Converts to a function that can be integrated
B1_partial = int(b1_func, x, 2, 3); %First integrates the x from 2 to 3
B1 = int(B1_partial, 1,2 ); %Integrates y from 1 to 2.
%Only one variable (y) is present, so no need to add y in the integral
%parameters.
-Thanks
Mukunda
Walter Roberson
on 28 Apr 2025
b1_func = matlabFunction(b1)
It is likely that you instead want something like
b1_func(x,y) = b1;
syms x y
b1 = [y - 2, 2 - y, y - 1, 1 - y
x - 3, 2 - x, x - 2, 3 - x]
b1_func(x,y) = b1
B1_partial = int(b1_func, x, 2, 3)
B1 = int(B1_partial, 1,2 )
Mukunda
on 29 Apr 2025
Can I know how is this different from what I wrote?
Torsten
on 29 Apr 2025
Can I know how is this different from what I wrote?
What you wrote ?
Mukunda
on 29 Apr 2025
I added (wrote) a comment.
Walter Roberson
on 29 Apr 2025
Edited: Walter Roberson
on 29 Apr 2025
You wrote
b1_func = matlabFunction(b1) %Converts to a function that can be integrated
which creates an anonymous function handle representing the exxpression in b1 . You then int() the anonymous function -- which converts the anonymous function back into a symbolic expression again.
I, on the other hand, used
b1_func(x,y) = b1
which creates a symbolic function from b1 with parameters x and y. I then proceed to int() the anonymous function -- saving the step of converting to a function handle.
If you were going to use matlabFunction() then you should have used numeric integration using nested integral() calls and the 'arrayvalued' option. (You cannot use integral2() because integral2() does not work with expressions that return arrays.)
Mukunda
on 29 Apr 2025
Ah, I see. Thank you!
My Code was incomplete in the above written comment. It worked for me as I added those things in code(but those lines were way above).
Thank you!
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
