Beantwortet
Why cant I get a stable Cranck Nicolson discretization?
We use a Dirichet boundary condition so that x=0 for t = 0 and a = 0. And which conditions at a = a_end ? Try "pdepe". If th...

mehr als 3 Jahre vor | 0

Beantwortet
Optimising Limits of Chain integrals
fun1 =@(g1) 208.4*exp(-0.02704.*g1)-293.9*exp(-0.1286.*g1); fun2 =@(g2) 108.3*exp(-0.01137.*g2)-622.8*exp(-0.1578.*g2); A = ...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Is it possible to add more constraints than the default ones in LSQLIN function?
Use "fmincon" with the constraint (C*x).*d >=0 and define this constraint in function "nonlcon".

mehr als 3 Jahre vor | 2

Beantwortet
Hi, i am trying plot my thesis graph using dde23 but i keep on getting this error, derivative and history function have different lengths.. HELP PLEASE!
z(:,1) is a 3x1 vector with z(1,1) = y1(t-0.02), z(2,1) = y2(t-0.02) and z(3,1) = y3(t-0.02), You have to decide which of the t...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to solve error using integral (line 83) first input argument must be a function handle?
T = 1; m = 64; x = 1:0.1:2; y = 2:0.2:10; [X,Y] = meshgrid(x,y); g = @(u)sin(2*pi*u); phi = @(t,x,y) ((sign(x/y+g(t/T)).*(...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Double monod maximum rate estimation
% Initial guess for rmax rmax0 = ...; % Time is a (nx1) vector, % Sdata is a (nx2) matrix with measurements of c_CH4 (1st c...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to calculate the symbolic integration of rational functions?
syms x f = x^4+x^3+x^2+x+1; fp = partfrac(1/f,x,'FactorMode','real') int(fp,x,0,1) vpaintegral(1/f,x,0,1) f = matlabFunctio...

mehr als 3 Jahre vor | 3

Beantwortet
I couldn't understand why this program took a long time to run, can anyone help me to solve the problem so that the code can run fast
The reason is this line: U = sort(rand(1,20).*(0.005)+rand(1,20).*(0.003),'ascend'); MATLAB integrators are not suited to cope...

mehr als 3 Jahre vor | 0

Beantwortet
Trying to use Newton's method until solution converges
% Variables Eps = 0.011; E = 73100; H = 662; n = 0.07; maxIter = 100; % # of iterations Tol = 1e-8; i = 1; error = 1.0; ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Solve System of Equations to calculate the inverse kinematics
X = cos(q1)*(cos(q2 + q3) + cos(q2)); Y = sin(q1)*(cos(q2 + q3) + cos(q2)); Z = sin(q2 + q3) + sin(q2) + 1/5; Dividing equati...

mehr als 3 Jahre vor | 1

Beantwortet
I have a problem with solve command
syms x y [x y] = solve([3*x-y==2,x+y==1])

mehr als 3 Jahre vor | 0

Beantwortet
Write a row and column vector as matrix index
a = [4 5 3]; % Generate index vectors A and B [A,B] = ndgrid(a,a); A = A(:) B = B(:) % Use A and B as index vectors for a m...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
3D Contour plot. Filled slices/surfaces are black
The mesh lines are black and cover the colors. To remove them, use gr = slice(Xg, Yg, Zg, Vg,[],[],zslice); set(gr,'Edgecolor...

mehr als 3 Jahre vor | 0

Beantwortet
Hoe can I convert my script to a function?
If the coefficients don't change in the course of the simulation, you should read "Coefficient.mat" only once and pass the matri...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
a = b<0
"a" is a logical variable. It is set to "true" (=1) if b<0, else it is set to "false" (=0). The next operation c = 3*a works a...

mehr als 3 Jahre vor | 2

Beantwortet
How to compare previous results in iteration?
You should never check whether two variables are equal. Always check whether they are approximately equal: difference = 1.0; o...

mehr als 3 Jahre vor | 1

Beantwortet
Euler method: ODE with different initial conditions
Y0 = 0.5:0.05:1.5; hold on for i = 1:numel(Y0) y0 = Y0(i); [x,y] = euler(y0); plot(x,y) end hold off functio...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
The solve function doesn't work properly
syms l1 l2 l3 H B phi gamma theta eq1 = l3*cos(gamma) - l2*cos(phi) + l1*sin(theta) + B == 0; eq2 = l3*sin(gamma) - l2*sin(ph...

mehr als 3 Jahre vor | 0

Beantwortet
How can I avoid looping here?
STD_w=0.05; STD_gama=5; mean_w=linspace(15,40,10); sigma_w=ones(1,length(mean_w))*STD_w; mean_gama=linspace(115,85,10); sig...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Partial Least Squares regression - confidence interval of the predicted variable (response)
I did not look into your code in detail, but I think you could use the output structure "gof" from MATLAB's "fit" together with ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
recall Equation of fit curve and integrate
https://de.mathworks.com/help/curvefit/cfit.integrate.html

mehr als 3 Jahre vor | 0

Beantwortet
Convert graph figure to equation
x = @(t) (t+4).*(t>-4 & t<-2) + (t-4).*(t>2 & t<4); t = -6:0.01:6; plot(t,x(t)) grid on

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to compare previous iteration output with current iteration output?
xold = 2; error = 1; while error > 1e-6 x = xold - (xold^2-2)/(2*xold); error = abs(x-xold); xold = x; end x ...

mehr als 3 Jahre vor | 0

Beantwortet
The real() command outputs a complex number (doesn't appear to change it).
isreal(real(double(eigen(t)))) instead of isreal(real(eigen(t)))

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
introducing a comparison related to variables in linear programming
Your constraint says that X9 = max(0,X1+X2-Pdemand) X10 = max(0,Pdemand-(X1+X2)) Usually, it suffices to set the constraints ...

mehr als 3 Jahre vor | 0

Beantwortet
How to use one fmincon optimizer in a loop and one optimizer out of that loop?
Why don't you optimize all parameters in one call to fmincon ? It's not a problem that Ea and k are different for each dataset,...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Why receive error Integrand output size does not match the input size?
x and y that are inputs to Hf from integral2 are usually matrices (of the same size). The output of Hf is expected to be of the...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Iteration of multiple nonlinear functions
%Given values k = 0.84; Qh = 25; Ti = -3; To = -3; hi = 6; ho = 20; dx = 0.002; dy = 0.01; n_steps = 1000; tau = 0.078...

mehr als 3 Jahre vor | 1

Beantwortet
Pass variables between functions
If you type PB(Bmatrix,D) then Bmatrix and D are inputs to the function PB. Thus they must somehow be defined before this call...

mehr als 3 Jahre vor | 0

Beantwortet
Error in using lsqcurvefit with constrained parameters.
Maybe fixedset = logical([0 1 1]); fixedvals = [3 4]; xvary = 33; x = zeros(size(fixedset)); x(fixedset) = fixedvals; x(~f...

mehr als 3 Jahre vor | 0

| akzeptiert

Mehr laden