PDE Toolbox Coefficient Specification

2 Ansichten (letzte 30 Tage)
Haige
Haige am 2 Jan. 2024
Bearbeitet: Torsten am 2 Jan. 2024
This is the problem. Since the PDE toolbox does not accept variable parameters, I first set theta1 and theta2 to be both 0.01.
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
It gives me this error message when I click solve:

Antworten (1)

Torsten
Torsten am 2 Jan. 2024
Bearbeitet: Torsten am 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);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by