Answered
Euler method for 2nd and 1st order differential equation. Im not sure what im doing wrong
MATLAB's array indices start at 1. So x(0)=0.2;y(0)=1 %initial conditions will throw an error. Further I don't know why you ...

4 years ago | 0

Answered
solving PDE with boundary conditions involving derivative
Cf = ...; bcfcn = @(zl,Cl,zr,Cr,t)setBC(zl,Cl,zr,Cr,t,Cf); sol = pdepe(m,eqn,@findIC,bcfcn,z,t); function [pl,ql,pr,qr]=set...

4 years ago | 0

| accepted

Answered
Condensing code cannnot figure out easier function to use
number_of_elements = 9268; blocklength = 300; maximum = 30; rest = mod(number_of_elements,blocklength) number_of_elements...

4 years ago | 0

Answered
How to depicted the R function versus alfa in my code?
ALFA = 0:0.01:10; bet = 2; lan = 1; teta = 2; mu = 0.5; n = 4; k = 2; R = zeros(size(ALFA)) for...

4 years ago | 0

Answered
How do I make a range for a graph that is from 0 to 2pi in increments of pi/4?
Theta = 0:pi/4:2*pi or Theta = linspace(0,2*pi,2*pi/(pi/4)+1);

4 years ago | 0

| accepted

Answered
How to get 3D histogram with marginal histograms
https://stats.stackexchange.com/questions/24568/normalizing-a-2d-histogram-and-getting-the-marginals

4 years ago | 0

Answered
How to solve 2nd order DE with Explicit Euler method?
g = 9.81; L = 1.0; T = 1.0; dt = 0.01; y_0 = pi/2; v_0 = 0; f = @(t,y)[y(2),-g/L*sin(y(1))]; t = (0:dt:T).'; nt = nu...

4 years ago | 0

| accepted

Answered
MATLAB PDE BC'S
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t) Nu = 1.0; % left Bc = ul pl = 0; ql = 1; % right BC= ur pr = Nu*ur; qr =...

4 years ago | 0

Answered
Multiple fminbnd errors with a parametrized function
You are in the realm of numerical, not symbolic computations. Here, functions are defined as handles: fun = @(t) exp(cos(t)) -...

4 years ago | 1

| accepted

Answered
Finite difference method to solve a nonlinear eqn?
g = 9.81; L = 1.0; T = 1.0; dT = 0.01; y_0 = pi/2; v_0 = 0; f = @(t,y)[y(2);-g/L*sin(y(1))]; tspan = 0:dT:T; y0 = [y_0...

4 years ago | 0

| accepted

Answered
Integral of a matrix (x = integration(v)dt) to find x in each time step - how to get it?
After replacing the NaN values in the matrix, just do T = [5 5.005 5.015 5.020 5.025]; A = [0.223886255942431 0.76659480876201...

4 years ago | 0

| accepted

Answered
Generate Random Numbers to satisfy a variable on the left and right hand side
Here is a code with which you get M2 versus M1 curves for the vector P01 of pressures for which the relation Ctheta_exitvolute...

4 years ago | 0

Answered
too many input arguments when using pdepe
sol = pdepe(m,@(x,t,u,dudx) wave_ode1(x,t,u,dudx,p),@pdeic2,@pdebc2,x,t); function [c,f,s] = wave_ode1(x,t,u,dudx,p) % Equati...

4 years ago | 0

| accepted

Answered
iUsing ode45, how to pass a parameter from odefun to an events function?
You'll have to calculate loadfV twice if you don't want to use globals. But you should use a third function different from BD_i...

4 years ago | 0

| accepted

Answered
How to get back the original matrix?
A = [1 2 3 2;... 4 1 2 3;... 3 4 3 2;... 2 4 1 1] R = [1 3 4 2]; B = A(R,:); Rinv(R) = 1:numel(R); A_recovere...

4 years ago | 1

| accepted

Answered
2 equations one unknown
v = sqrt(95*9.8/0.24)*tanh(sqrt(0.24*9.8/95)*8) y = 95/0.24*log(cosh(sqrt(0.24*9.8/95)*8))

4 years ago | 1

Answered
"Error using vertcat Dimensions of arrays being concatenated are not consistent." why this error showing?
function "my_ode" lacks an "end" statement.

4 years ago | 1

Answered
I want to get the values from the last two iteration
% Tolerances, Maximum number of iterations tolF = 1e-6; tolX = 1e-8; itermax = 30; % Start values xim2 = 6; ...

4 years ago | 0

Answered
How to get the output result from a jacobian as this.
jac = subs(jac,[X1,X2,X3,X4,X5,X6,X7],[X0(1),X0(2),X0(3),X0(4),X0(5),X0(6),X0(7)])

4 years ago | 0

| accepted

Answered
Calling a function inside an integration
t = 36:1:64; v = 7.65; h = 435; r = tand(15)*h; lambda = 0.21; Aeff = 0.57; for i = 1:length(t) yi = r - v*(t(i)); ...

4 years ago | 1

| accepted

Answered
how to set a loop to calculate time
t0 = 0.01; n = log(24/t0)/log(1.1); t = t0*1.1.^(0:floor(n)); t(end+1) = 24.0;

4 years ago | 0

| accepted

Answered
Store elements of a matrix but ONLY IF the respective element of ANOTHER matrix meets condition.
matriz_viaveis = NaN(size(matriz_angulodecarga)); for x= 1:size(matriz_angulodecarga,1) for y = 1:size(matriz_angulodecarg...

4 years ago | 1

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
t=linspace(0,50,501); vel=zeros(1,501); %d=zeros(1,501); dT = zeros(1,501); dT(1) = 0.1; vel(1) = 20; for n=1:500 if ...

4 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side
I doubt that "computeF1clustering" returns one single real number, does it ? That's what you assume when you try to write the r...

4 years ago | 0

Answered
Saving to Arrays in for loop
Qe = 12; M = 1002; aArr = zeros(M,1); eArr = zeros(M,1); daArr = zeros(M-1,1); deArr = zeros(M-1,1); T = [0:1000]; eArr(1...

4 years ago | 0

| accepted

Answered
How to specify a 3 element column vector in Euler's Method for ODE
Here is a hint: https://de.mathworks.com/matlabcentral/answers/1676979-how-do-i-use-euler-s-forward-difference-method-and-the-s...

4 years ago | 0

| accepted

Answered
Numerical integration (vpaintegral) of bessel function of the second kind (bessely)
Plot bessely(1,rho) in the interval [0,1]. Seems there is a singularity at x=0.

4 years ago | 1

Answered
trigonometric equation solution help
When I plot the function for several values of err and space, I only see a zero at k=0 and k=0.5. Can you give values for err a...

4 years ago | 0

| accepted

Load more