Respondida
RK4 method to solve a 2nd ODE.
The definition of the function handles f1 and f2 is wrong: f1 = @(u,z,t) z0; % Initial f1 f2 = @(u,z,t) A*z0(t)+B*u0...

más de 3 años hace | 1

Respondida
the code is so slow , ode23, what can I do get it faster
B1 = [0.007664184 -2.9881 0.000406092 0.1383288248 10 0.0053322412 -3.048 0.0002825517 0.0714132532 12 0.0042969663 -3...

más de 3 años hace | 0

| aceptada

Respondida
How to calculate u for every alpha?
... f= @(x)(0*zeros(size(x))); alpha = [2,5,10,15,20]; %lineare Basisfunktion A = assemDiffusion1D(nodes, epsilon); b = ass...

más de 3 años hace | 0

| aceptada

Respondida
Using least square fitting function lsqr
rng(0) n = 20; s = rand(1, n) > 0.5; s = repmat(s', 1, 100)'; s = s(:)'; t = linspace(0, n, numel(s)); subplot(2, 1, 1) p...

más de 3 años hace | 1

| aceptada

Respondida
Code optimization by way of selective computations
Ts = 1e-7; t = 0:Ts:1-Ts; tic s_t = exp(1i*2*pi*t(1:2:end)); toc or if your condition is more complicated: tic s_t = exp(1...

más de 3 años hace | 0

Respondida
how to combine to get single graph in optimal control problems
Use "hold on" and "hold off" to plot several graphs in one figure: f = @(x) x.^2; g = @(x)sqrt(x); x = 0:0.01:1; hold on pl...

más de 3 años hace | 0

Respondida
How to get numerical answers for solving determinant is 0
This is a generalized eigenvalue problem. Use "eig" to solve for p: E = 210 * 10^9; k1 = zeros(8, 8); k2 = zeros(8, 8); k1(1...

más de 3 años hace | 0

| aceptada

Respondida
How to Call a Function Within a Script?
You have two options: Either define your derivatives in a function: [t,y] = ode15s(@vdp1000,[0 3000],[2 0]); plot(t,y(:,1),'-...

más de 3 años hace | 0

| aceptada

Respondida
I'am trying to find minimum cost spanning tree by using Kruskal's algorithm and get these errors
nodes = unique([nodes; mst(ismember(mst(:,1),nodes),2)]); nodes is 1x2, mst(ismember(mst(:,1),nodes),2) is 1x1, Thus concatenat...

más de 3 años hace | 0

| aceptada

Respondida
Need help converting equation into matlab code.
cp = c1*(c2./u - c3*beta - c4).*exp(-c5./u) + c6*lambda; instead of cp = c1.*(c2./u)-(c3.*beta-c4).*(exp(-c5./u))+(c6.*lambda)...

más de 3 años hace | 1

| aceptada

Respondida
Writing a solver for DAEs with Runge-Kutta method
It seems that your DAE solver solves the third equation as a differential equation, not as an algebraic equation (see below). c...

más de 3 años hace | 1

Respondida
Incorrect values when calculating the optimum value using while loop
With regards to for loop, I used it to be able to do j-1 as a previous step But the steps (variable i) are done in the while lo...

más de 3 años hace | 0

| aceptada

Respondida
Iterating using while loop over a vector
And how do we obtain ro_j and z_j from P_(j-1) in step 4 ? And how to calculate P_j ? j = 0; error = 1; rho=[1,0,0,0,0,0,0,0...

más de 3 años hace | 0

Respondida
Some one check this code of solving ODEs . Is it correct or not?
Now it's smooth. But you still don't know whether the results are correct if you don't test your code with differential equation...

más de 3 años hace | 1

| aceptada

Respondida
How to find coordinates of intersecting line?
fs= 8192*2; % sampling frequency dt = 1/fs; % sample time ...

más de 3 años hace | 0

Respondida
How to solve a differential equation with a time-varying term?
Use "interp1" to interpolate the elements of K to the time t requested by the ODE integrator.

más de 3 años hace | 0

| aceptada

Respondida
How to solve the following third-order ordinary differential equation with bvp4c
xmesh = linspace(0,10,2000); solinit = bvpinit(xmesh, @guess); sol = bvp4c(@bvpfcn, @bcfcn, solinit); plot(sol.x, sol.y(1,:))...

más de 3 años hace | 0

| aceptada

Respondida
help solve odefcn with time dependence
tspan = 1:0.1:10^3; y0 = [sqrt(0.9) sqrt(1.1) sqrt(1)]; U=1; J=1; N=3; % gewenste aantal deeltjes per site mu=U*N-J; % che...

más de 3 años hace | 0

| aceptada

Respondida
Help Please! I'm plotting curve for (7,4) hamming code.
ber(a) = numerrs/num_bits; instead of ber = numerrs/num_bits;

más de 3 años hace | 0

Respondida
Plotting multiple quadrics in 3D
https://de.mathworks.com/help/matlab/ref/fimplicit3.html

más de 3 años hace | 0

Respondida
Finding volume of a solid generated by revolving a curve.
Compute the volume V1 of the solid generated by revolving y = sqrt(x) around the x-axis between 0 and 2. Compute the volume V2 ...

más de 3 años hace | 0

Respondida
how to define an iteration number ?
The number of iterations is initialized as 0 : i = 0; Within the while loop, for each time the while loop is repeated, the nu...

más de 3 años hace | 1

Respondida
how to make a 3x3 matrix a 9x1 matrix?
x=[ 1 2 3; 4 5 6; 7 8 9]; x = reshape(x.',[9 1])

más de 3 años hace | 0

Respondida
Find x and y values of a 2D gaussian given a value for the function
Note that g0/exp(1) will not work in the below case since f(x,y) >= a(4) = 1 for all (x,y). a = [1 1 1 1 1 1]; f = @(x,y) (a(1...

más de 3 años hace | 0

| aceptada

Respondida
solving non linear equations
syms x y z errX = 10; errF = 10; imax = 25; TolX = 1e-8; TolF = 1e-8; f = [ x^2+x-y^2+x*y+z^2-3 5*(y^2)+y+y*z-x^...

más de 3 años hace | 0

Respondida
How do you solve a System of 11 Non-Linear Equations Inter-linked to one another?
U0 = [663 255]; options = optimset('TolX',1e-12,'TolFun',1e-12); format long U = fsolve(@fun,U0,options) fun(U) function ...

más de 3 años hace | 0

Respondida
initial value problem integration
You get an implicit equation in h that must be solved numerically for h for a given value of t: syms h t f = (-9.5883*h^5+110....

más de 3 años hace | 1

Respondida
Error using / Matrix dimensions must agree.
kappa=K./RHOCP; instead of kappa(i,j)=K/RHOCP;

más de 3 años hace | 1

| aceptada

Respondida
Why is my ode15 differential equation solver acting like this?
Seems you have an error in the sign of the time derivative for mp: dmp = -(2*pi)*D*Cm*dp*(cp-cinf); %% differential for mass (m...

más de 3 años hace | 0

Respondida
How do I correctly use vpasolve?
You have 2 equations for 1 unknown. MATLAB's symbolic toolbox does not solve such systems. Is n supposed to be real or complex ...

más de 3 años hace | 0

Cargar más