Answered
Differential algebraic eqn solving using ode15s
for i = 0:5 mu0(i+1) = w10*L10^i + w20*L20^i + w30*L30^i; end instead of for i = 1:6 mu0(i) = w10*L10^i + w20*L20^i...

4 years ago | 0

Answered
Discrete and continuous random variables distribution
n = 10000; x = rand(n,1); n1 = numel(x(x<=0.5)); n2 = numel(x(x>0.5)); y1 = randn(n1,1); y2 = zeros(n2,1); y = [y1;y2]; h...

4 years ago | 0

| accepted

Answered
How do you make a matrix with alternating numbers in a nested loop?
n = 5; x = zeros(n^2,1); x(1:2:end) = 2; x(2:2:end-1) = 3; x = reshape(x,n,n)

4 years ago | 0

Answered
How to calculate the errors for Finite Element Method for 1D Poisson equation?
You must use higher precision for the output of the solution because now, the solution with 16 elements is classified worse than...

4 years ago | 0

Answered
Equation ellipse with foci at origin
You already did it because ellipses that are given by r=a.*(1-e.^2)./(1-e.*cos(t)) automatically have one focus at the origin (a...

4 years ago | 1

| accepted

Answered
How to perform integration inside for loop? [matrix dimension must agree issue]
Use alpha_x{v} = integral(attenuation,0,depth,'ArrayValued',true); output{v} = alpha.*Irradiance.*exp(-depth); instead of a...

4 years ago | 1

Answered
how to find specific variable values for solving equation system
Yes. You have 13 linear equations for 13 unknowns P = [pr(1),...,pr(7),p1,...,p6]. Write the system as A*P = B and solve for...

4 years ago | 0

Answered
How to plot a function in a for loop?
function main n = 3; u = 0:0.001:1; for i = 1:n+1 %this loop returns 4 curves, I want to plot them on a single graph ...

4 years ago | 1

| accepted

Answered
Solving a vector equation of motion in matlab
Set x0 = x(1), x0dot = x(2), x1 = x(3) and x1dot = x(4). Then your equations read function main alpha = ...; gamma0 = .....

4 years ago | 1

Answered
loop in a loop
The outer loop is superfluous - so I deleted it. dt = ...; B = ...; f = @(y) ...; g = @(y) ...; t = ...; y = zeros(size(t)...

4 years ago | 0

Answered
How to simulate generated CDF in Matlab
a = 1; N = 1e5; x = rand(N,1); y = [a/2*(-1+(2*x(x<=0.5)).^(1/3)) ; a/2*(1-(2*(1-x(x>0.5))).^(1/3))] cdfplot(y) hold on T1...

4 years ago | 0

Answered
Performing Iteration for a Matrix
L = 2; CF = 0.25; a = [0 0.2 -0.6; -0.2 0 0.4; 0.6 -0.4 0]; n = size(a,1); A = zeros(L,n,n); A(1,:,:) = a; for l = 2:L ...

4 years ago | 1

| accepted

Answered
the length of the time span in ode45
If by "length of the time span" you mean" the number of output times (for the end time of integration fixed)", the answer is no ...

4 years ago | 0

Answered
How do I find if the three arrays of unequal size have the same values?
... or intersect(i1,intersect(i2,i3))

4 years ago | 1

Answered
Adjust the launching angle to produce the greatest range (i.e. maximum horizontal distance) but within 0° ≤ 𝜃଴ ≤ 90° in incremental of 0.1. Evaluate your results.
To answer vi), use ii) to determine t when the ball hits the ground for a given value of theta. Then, for this value for t, dete...

4 years ago | 0

Answered
Trying to plot the conversion of a reaction in a plug flow reactor.
Vspan = [0:1.0E-07:1.0E-05]; y0 = [2.26E-05; 0; 0]; T = 400; P0 = 1013.25; E = 85000; Fao = 2.5; [v,y]=ode45(@(v,y)ODEfun...

4 years ago | 0

Answered
Simpsons 1/3 Rule to solve integration
Be careful here: the pressure values are not equally spaced. Use T = 400; % Temp. in K P = [0.1 5 10 20 25 30 40 45 50]; % P...

4 years ago | 0

Answered
stochastic gompertz model and using ode15s
function yr = fit_GompModel(tr,p) % Objective Function: Integrates ODE & Returns Vector x0 = 20; % Initial Value of the diffe...

4 years ago | 0

Answered
integration of number array with variable
Ez=...; TEz = ...; q=...; mstar=...; h=...; kB=...; T=...; J = zeros(size(T)); for i = 1:numel(T) Y = TEz.*...

4 years ago | 0

Answered
Product inside summation in Matlab
For infinite vectors (a)_j and (b)_j and oo replaced by Kmax t = 2; Kmax = 50; prod1 = a(t+1:Kmax).^(t+2:Kmax+1); B = b(t+1:...

4 years ago | 0

Answered
Product inside summation in Matlab
The expression equals a^(t+1) + b^(-t*(t+1)/2) * sum_{k=t+1}^{oo} a^(k+1)*b^(k*(k+1)/2) This should be easy to code.

4 years ago | 0

Answered
Trapezium Graphs Plots not Plotting
x_dot = theta_step*(x_double_dot_nan(i+1) + x_double_dot_nan(i))/2; %horizontal speed v_y = theta_step*(a_y_nan(i+1) + a_y_na...

4 years ago | 0

Answered
How to find area enclosed between two curves?
Lx = 150; Ly = 150; T0 =0; T1 = pi/4; T=3.175; N=8; W=N*T; X0=Lx/2; Y0=0; W_nominal=W/2; for a=1:2 ...

4 years ago | 0

| accepted

Answered
I am seeking help over the code for my numerical integration equation.
syms x y u_inf u = ...; % some function of x f = (1-u/u_inf)*u/u_inf; theta = int(f,x,0,y)

4 years ago | 1

Answered
Below Code is used for solving order 6 ODEs and is showing errors which i am unable to solve . Please Help.. Thanks!
f = @(t,X) [-2*X(1)+2*X(2); %dx1/dt 0.5*X(1)- 2*X(2) + 1.5*X(3); %dx2/dt 0.667*...

4 years ago | 0

Answered
Using Linprog to perform a MaxMin optimization.
min: -v v <= -3*z1 + 2*z2 v <= z1 - z2 + additional constraints

4 years ago | 1

| accepted

Answered
Need help in finding all the solutions of non linear ellipse equations using Newtons Method using following code.
Maybe a symbolic approach is want you want: syms x y res1 = (x+y+2)^2 + (x+3)^2 - 5 == 0; res2 = 2*(x+3)^2 + (y/3)^2 - 4 == 0...

4 years ago | 1

Answered
Dot indexing is not supported for variables of this type. How to fix this?
r5guess.*cos(th5guess) r5guess.*sin(th5guess) instead of r5guess.cos(th5guess) r5guess.sin(th5guess)

4 years ago | 0

| accepted

Answered
Graph Not Plotting for the For Loop Code
H=linspace(0,40000,4001) rho=zeros(1,numel(H)) for i=1:numel(H) h = H(i); if h > 25000 T = -131.21 + h.*0.0...

4 years ago | 1

Answered
how can i wrote a geometric series
help cumsum ZZ_d = cumsum(position_d)

4 years ago | 0

| accepted

Load more