Respondida
Make a loop with a function to vary one value
tspan = [0 :0.01:20]; y0 = 0; opt = odeset('RelTol',1e-12,'AbsTol',1e-16,'MaxStep',0.001); Eta = [10, 50, 100, 500, 1000]; f...

más de 3 años hace | 0

| aceptada

Respondida
Verify the Divergence theorem in MATLAB
Nice exercise. syms X Y Z x y z syms a phi positive F = [X^2*Y^2,Y^2*Z^2,Z^2*X^2]; divF = diff(F(1),X)+diff(F(2),Y)+diff(F(...

más de 3 años hace | 0

Respondida
How to get the derivate using bvp4c
I assumed Alpha = A in your code. clc; p=0.01; Betaf= 207; Betas = 17; Beta = 0.5; kof = 0.613; kos = 400; m = 1; b2 = ...

más de 3 años hace | 0

| aceptada

Respondida
How can I more fully vectorize to eliminate for loops?
Wans2 = (sum(G.*(W.'-V),2)).'

más de 3 años hace | 0

| aceptada

Respondida
Trying to use fsolve works over lower part of range (values < 10) but fails in upper part of range (values > 10)
It's very important that you have a good initial guess for pHv given Vbv. So looping over the complete range of Vbv and taking ...

más de 3 años hace | 1

| aceptada

Respondida
List of all Binomial permutations with a certain number of events
n = 8; A = dec2bin(0:2^n-1)-'0' A4 = A(sum(A,2) == 4,:) 8*7*6*5/(4*3*2*1) % more general Ai = arrayfun(@(i)A(sum(A,2) == i,...

más de 3 años hace | 0

Respondida
Code for solving first-order ode with symbolic initial condition
syms y(h) k ode = diff(y) == k*y; sol_ode_general = dsolve(ode) vars = symvar(sol_ode_general) eqn1 = subs(sol_ode_general,v...

más de 3 años hace | 0

| aceptada

Respondida
How to convert PDE into matrix form
Can you write this in matrix form ? m1*diff(x1(t), t, t) + 0*m2*diff(x2(t), t, t) + (c1 + c2) * x1d - c2 * x2d + (k1 + k2) * x...

más de 3 años hace | 0

Respondida
Why do I receive the error in horzcat?
blkdiag(ddf(x), zeros(n)) is 2x2, A' is 1x1. Thus it's not possible to concatenate the two horizontally in the command H...

más de 3 años hace | 0

Respondida
Determine the coefficients in symbolic
I don't know why the coefficients appear in the wrong order. syms In In_1 On_1 On = 91/100*In-7/8*In_1+1/2*On_1; coeffs(On,[I...

más de 3 años hace | 0

| aceptada

Respondida
how to solve non-linear equations in a nozzle
Maybe you can give better initial guesses in x0 for the solution than I can ... x0 = 10*rand(7,1); options = optimset('Max...

más de 3 años hace | 1

| aceptada

Respondida
Solving Nonlinear System of Equations with 10 variables
W=100; s=10; S=23; %F=13; %m=9; fun = @(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10)... [5-(W+S*9)*X1+S*9*X2-S*20*X1^2+S*20*X...

más de 3 años hace | 0

Respondida
calculating Double integral over a region
syms x y int(int(2,y,-sqrt(1-(x/3)^2),sqrt(1-(x/3)^2)),x,-3,3)

más de 3 años hace | 1

| aceptada

Respondida
I am struggling to plot iteration vs error in the matlab code? can anyone help me with this? very much appreciate it.
% Inputs: A - Coefficient matrix A=[2 -1 0;-1 2 -1;0 -1 2]; % b - Input matrix b = [0; 2; 0]; % x0 - Initial guess x0 = [0...

más de 3 años hace | 0

| aceptada

Respondida
Is it possible to get a time-dependent function as an output of an ODE solver?
clear all clc I0= 500; % maximum flow Tc=60/72; % heart period Ts=(2/5*Tc); % time in systole P_ss=80; % diastolic p...

más de 3 años hace | 0

Respondida
Error in the script
x = -1 : 0.001 : 1; y_div = (x.^2) ./ (1 + (x.^2)); title ('División acotada'); plot (x, y_div);

más de 3 años hace | 0

Respondida
Reverse problem of finding time-varying parameters of an ODE with the help of solution data.
Use "lsqcurvefit" to fit the parameters together with an integrator (e.g. ODE45). For an example, see Star Strider's code under...

más de 3 años hace | 1

Respondida
im trying to solve a system of 4 nonlinear equations with 4 unknowns
Equations (1), (3) and (4) give x(2) = 0. Thus it's impossible to satisfy equation (2) where x(2) is in the denominator. syms x...

más de 3 años hace | 0

Respondida
Corrective action after Newton iteration exception
I wonder if a similar corrrective action happens whenever a Newton-iteration exception occurs: in this case, does the solver sim...

más de 3 años hace | 0

| aceptada

Respondida
The size of X must match the size of Z or the number of columns of Z.
Change dx = 1.01/(Nx-1); dy = 1.01/(Ny-1); to dx = 1.0/(Nx-1); dy = 1.0/(Ny-1);

más de 3 años hace | 0

| aceptada

Respondida
Why should I tighten error tolerances if I am violating minimum stepsize?
The stepsize reduction down to the minimum stepsize often occurs because in previous time steps, the solver was not exact enough...

más de 3 años hace | 0

| aceptada

Respondida
Num2cell question
Most probably too large for your computer: A = rand(12,3,5) A = num2cell(A)

más de 3 años hace | 0

Respondida
Matlab produces complex number where it cannot be produced
Because (Req.^3-b.*Req.^3)/(R.^3-b.*Req.^3) is negative. If you use k1 = 4; k2 = 1/3; P0=1.00*10^5; Req=69.2*10^(-3); b=...

más de 3 años hace | 1

| aceptada

Respondida
Help with fminsearch to maximise non-analytic function via specific parameters
Here is the optimization solution: theta0 = 10; sol = fminsearch(@fun,theta0) function range = fun(theta) global rho d m g...

más de 3 años hace | 0

| aceptada

Respondida
Why are the inputs to the functions used in the ODE45 solver not in the right syntax?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %This is in thé main script: field = [1,0,1 ; 1,1,1]; %in my script ...

más de 3 años hace | 0

| aceptada

Respondida
2nd order differential eqn for Windkessel model
I = @(t) I0*sin((pi*t)/Ts).^2.*(t<=Ts); %input current flow Idot = @(t) I0*2*sin(pi*t/Ts).*cos(pi*t/Ts)*pi/Ts.*(t<=Ts); Idotdo...

más de 3 años hace | 0

| aceptada

Respondida
Help with fminsearch to maximise non-analytic function via specific parameters
Of course, you could use fminsearch for optimization. But using it, you will only get a single point of the below graph. Theta ...

más de 3 años hace | 0

Respondida
What type of solver is VPA Solve?
https://de.mathworks.com/matlabcentral/answers/298048-which-algorithm-does-vpasolve-use

más de 3 años hace | 1

Respondida
"Error using indexing Not enough inputs to inline function; Error in NRM (line 93) INJAC=JAC(x1,x2)" showing in a multivariable Newton Raphson program.
For the 3-variable case, the line INJAC=JAC(x1,x2); has to be changed to INJAC=JAC(x1,x2,x3);

más de 3 años hace | 0

Respondida
Im trying to use gradient decent with a for loop to determine the value of x that minimizes the function
f = @(x) x.^2 - 3*x + 1; iterations = 15; alpha = 0.15; x = zeros(iterations,1); x(1) = 0; for...

más de 3 años hace | 0

Cargar más