回答済み
Can I include an ODE when I solve a system of PDEs in pdepe
No, but this code should work for your purpose: https://de.mathworks.com/matlabcentral/fileexchange/97437-pde1dm?tab=reviews

約3年 前 | 0

| 採用済み

回答済み
solving a multivariate equation (4 equations, 4 variables) for n rows data using loop
syms Aprim0 Bprim0 Xmid Ymid R real syms Xup Xdown Yup Ydown % Define system of equations eqn1 = Yup - Aprim0*Xup - Bprim0 =...

3年以上 前 | 0

| 採用済み

回答済み
How to make a tridiagonal matrix (N-1)*(N-1), with different values in the first row?
Change the two values manually after you created A with the "standard" diagonal vectors. A = ...; A(1,1) = A(1,1) + 4/3; A(1,...

3年以上 前 | 0

回答済み
Sparse matrix x = A/B
Don't post pictures, post your code in plain ascii so that we are able to copy and execute it. Your A in the picture you posted...

3年以上 前 | 0

回答済み
Why bvp4/5c produces anomalous solution when using parameter passing using anonymous functions ?
Works for me. With each call to bvp5c, the options structure has to be modified because e changes within the loop. e = 1; so...

3年以上 前 | 0

| 採用済み

回答済み
When I run my code, I keep getting this error: "The following error occurred converting from sym to double: Unable to convert expression into double array."
So you have a constant source term int^1_0(y'*x)dx in all grid points - independent of the position x in the interval [0 1] ? ...

3年以上 前 | 1

回答済み
Error while running "lsqcurvefit" function. "Failure in initial objective function evaluation. LSQCURVEFIT cannot continue."
Before calling lsqcurvefit, try to evaluate your function by fun(c0,xdata) and see what you get. If this evaluation is not pos...

3年以上 前 | 1

回答済み
Removing vertical lines in a piecewise function when discontinuty points are not known
Maybe something like this. But the jump height of 0.05 at discontinuities most probably has to be adjusted in other applications...

3年以上 前 | 1

| 採用済み

回答済み
Implicit system of ODEs, problem with ode15i
You can explicitly solve for yp - so there is no need to use ode15i. But the Gamma-problem remains. clc; clear all; close all ...

3年以上 前 | 0

回答済み
Is there a way to take integrals over changing variables? Matlab
As far as I can see from the plots, we get the same results. syms p0 x b zeta real % Calculate lift distribution pz(x) pz = p...

3年以上 前 | 0

回答済み
Problem using lsqnonlin with a simulink model
Did you study this example: https://de.mathworks.com/help/optim/ug/lsqnonlin-with-a-simulink-model.html ?

3年以上 前 | 0

| 採用済み

回答済み
Solving exact ODE and fplotting a solution curve.
Why do you think sol(1) in your code above gives a trivial solution ? Is y(x) = -exp(x) trivial ? syms y(x) ode = (exp(x + y)...

3年以上 前 | 0

| 採用済み

回答済み
how does fmincon interior-point algorithm deals wtih underdetermined system?
All optimization problems are "underdetermined" in the sense of what you wrote above (i.e. less equality constraints than unknow...

3年以上 前 | 0

| 採用済み

回答済み
remove negative values from one column and the corresponding data in another coloumn
t = linspace(0,1); x = -1+2*rand(size(t)); idx = x<=0; x(idx) = []; t(idx) = []; size(t) size(x)

3年以上 前 | 1

回答済み
How can I save one of variable in my function ?
After ode45 has finished, just recalculate NOD1 in the calling program for the time vector t: [t,x]=ode45(@odeHar,tspan,x0); ...

3年以上 前 | 2

| 採用済み

回答済み
Definition of the error function in lsqnonlin
Use a function instead of a function handle. p0 = [1 2]; x = 0:1/10000:10 p = lsqnonlin(@(p)fun(p,x), p0); function err = ...

3年以上 前 | 0

| 採用済み

回答済み
I don't know how to make a loop to my System ( System of coupled differential equation) with a heaviside step or square wave ?
ico=10; Vapp=0.6; V_T=1; V_m=.05; la=19.83; Ra=297.5; Rb=1457; Rs=8; Cm=1.2e-8; t_K=la/Ra; t_m=Cm*Rb; T = []; X = ...

3年以上 前 | 1

| 採用済み

回答済み
one error i can not solve plz solve it.
If you check the sizes of vs.' and 1j*2*pi*f_mod*t size(vs.') size(1j*2*pi*f_mod*t) you will see that multiplication...

3年以上 前 | 0

回答済み
Solving a complicated system of ODEs
You use dydt(5) and dydt(6) before they have been assigned their values: dydt(1) = -dydt(5) - k.*theta1; dydt(2) = -k....

3年以上 前 | 1

回答済み
Trying to plot 2 variable 3d graph. The z matrix is filled with NaN values only.
TMR = (f_m*(f_Cd*sqrt(2*(f_dP_factor*p_c)/f_d)))./(o_m*(o_Cd*sqrt(2*(o_dP_factor*p_c)/o_d))); instead of TMR = (f_m*(f_Cd*sqrt...

3年以上 前 | 0

回答済み
How to find the maximum value of two variables of a function in MATLAB
eta = 0.01:0.01:1; x0 = (1:1:100).'; z = 1e6*log2(1+(10^(30/10)*4*(3e8/(4*pi*1e12))^2*15^(-4)*exp(-0.0016*15))/10^(-90/10))*(-...

3年以上 前 | 0

回答済み
Updating of boundary condition during bvp4c solution procedure
In bvp4c, your boundary conditions at xl = xstart and xr = xend can take the form fl(xl,psil) = 0 and fr(xr,psir) = 0 where fl a...

3年以上 前 | 0

| 採用済み

回答済み
optimproblem does not solve an analytical equation correct
Works for me (see above). Your objective must return the norm of A*x (squared), not A*x.

3年以上 前 | 0

| 採用済み

回答済み
use symsum for equation forming and solving
The equation is linear in k_d. So collect all terms containg k_d on the left hand side, all other terms on the right-hand side...

3年以上 前 | 0

| 採用済み

回答済み
Obtain Hessian matrix from a sum of squares expression
Each optimizer expects the unknowns as a vector, not as a 2d-matrix. So choose an arrangement of your unknowns in a vector of s...

3年以上 前 | 2

回答済み
Error in dfdt (line 3)
The code line in the loop must read za(i) = (z(i+1)-z(i-1))/(2*h) instead of za(i) = (z(i+1)-(i-1))/(2*h) And call the funct...

3年以上 前 | 0

| 採用済み

回答済み
how can i write a code to find maximum error in Lagrange polynomial for given functions?
Choose a fine enough grid x on [0,2], evaluate your function(s) f(x) and the Lagrange polynomial(s) L(x) for the grid points and...

3年以上 前 | 0

回答済み
Can argument validation check if size is at least some value?
b = 1:5; v = size(b,2) >= 4 b = 1:3; v = size(b,2) >= 4

3年以上 前 | 0

回答済み
Variable output as "1x0 empty double row vector" halfway through the program after previous iterations in the for loop has normal output values for the same variables.
It may happen that no peaks can be found: RC = 1:4; V = 1:4; [Peaks, X_Peak_value] = findpeaks(RC, V)

3年以上 前 | 0

回答済み
trying to solve two non-linear simultaneous equations but I had an error figuring out my two unknowns (X(1) &x(2)) , can anyone pls help?
Maybe you divide somewhere by x(1) or x(2) in the definition of your function F (which would result in a division-by-zero in the...

3年以上 前 | 0

さらに読み込む