PDE Toolbox Coefficient Specification
2 views (last 30 days)
Show older comments
This is the problem. Since the PDE toolbox does not accept variable parameters, I first set theta1 and theta2 to be both 0.01.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1580276/image.png)
I don't think there is any problem with my coefficients c and a, but there are issues with the f. In this situation, I cannot clearly tell when to use ".*". There is not much info about it when I am reading page 2-89 and 2-90 on https://www.mathworks.com/help/pdf_doc/pde/pde.pdf
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1580316/image.png)
It gives me this error message when I click solve:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1580321/image.png)
0 Comments
Answers (1)
Torsten
on 2 Jan 2024
Edited: Torsten
on 2 Jan 2024
As I already answered, f has to be referenced as a function or a function handle in your case.
It cannot be given in the GUI - all inputs in the GUI can only be constant values.
c = 1;
a = 1;
theta1 = 0.1;
theta2 = 0.1;
specifyCoefficients(model,"m",0,"d",0,"c",c,"a",a,"f",@(location,state)fcoeffunction(location,state,theta1,theta2));
function f = fcoeffunction(location,state,theta1,theta2)
N = 1; % Number of equations
nr = length(location.x); % Number of columns
f = zeros(N,nr); % Allocate f
% Now the particular functional form of f
f(1,:) = 100*sin(2*pi*location.x).*sin(2*pi*location.y) - theta1/theta2*exp(theta2*state.u(1,:) - 1);
end
Or as a simple function handle:
c = 1;
a = 1;
theta1 = 0.1;
theta2 = 0.1;
fun = @(location,state,theta1,theta2) 100*sin(2*pi*location.x).*sin(2*pi*location.y) - theta1/theta2*exp(theta2*state.u - 1);
f = @(location,state) fun(location,state,theta1,theta2);
specifyCoefficients(model,"m",0,"d",0,"c",c,"a",a,"f",f);
0 Comments
See Also
Categories
Find more on Geometry and Mesh 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!