Multiplying functions and syms command

6 views (last 30 days)
Gavin Chamberlain
Gavin Chamberlain on 7 Mar 2021
Commented: Athul Prakash on 12 Mar 2021
So what I am trying to do is multiply two functions together then integrate it. I created a system of equations called g, and dg. I'm trying to go to the ith row of g and jth column of dg and integrate the function resulting from multiplying the separate functions together. Any suggestions?? I am very lost
for ii = 0:NRitz-1
for jj = 0:NRitz-1
u=matlabFunction(dg(ii+1));
p=matlabFunction(dg(jj+1));
m=matlabFunction(g(ii+1));
n=matlabFunction(g(jj+1));
syms xi
kRitz = @(xi)Cmod*u(xi)*p(xi);
KRitz1(ii+1,jj+1) = integral(kRitz,0,L);
end
end
  3 Comments
Paul
Paul on 7 Mar 2021
Edited: Paul on 7 Mar 2021
Are you trying to get numerical answers to fill in KRitz1 or symbolic? The posted code suggests numerical, but maybe that's not what you want?
What is L? It is a sym or a double?
Can you post a simple, but complete code that has all relevant variables (g, dg, L) defined? Including any error messages that are of concern.
Athul Prakash
Athul Prakash on 12 Mar 2021
Can you show how you have defined g and dg? Could you also clarify what Paul has asked about above?

Sign in to comment.

Answers (0)

Categories

Find more on Programming 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!