Answered
How to perform integration of product of multiple function inside a for loop?
for a=1:num x=depth(a); Photon_flux=@(lambda)((A*((((h*c)/lambda)^2)/(exp((((h*c)/lambda)/(k*Ts)))-1)))*q); ...

4 years ago | 1

| accepted

Answered
help solving polynomial equation
det(H) is a polynomial of degree 10 in w. Since the roots of polynomials of degree > 4 can't explicitly be given, you will have ...

4 years ago | 0

Answered
Why do I receive "Error using daeic12 (line xx) This DAE appears to be of index greater than 1." when using dae solver ode15s?
With the ODE15S solver in octave, the second code also works and gives the correct results: function main N_EQ = 5; % numb...

4 years ago | 1

| accepted

Answered
ODE solver-using initial conditions in events function
If you want to use the event option, you can pass x(0) as an additional argument to the event function function and return contr...

4 years ago | 0

| accepted

Answered
Finding all possible combinations of objects
Brute force: n1 = 83; n2 = 50; n3 = 125; n4 = 35; nsol = 0; for i = 0:n1 for j = 0:n2 for k = 0:n3 ...

4 years ago | 0

Answered
working on a simple vector addition but every result in the loop shows up, even after i allocate memory. can someone please help me out? thanks a lot
A = [7 21 30 40]; B = [11 4 14 6]; [rows, columns] = size(A); D = zeros(size(A)); for i = 1:rows for j = 1:columns ...

4 years ago | 0

Answered
Array as input for symbolic function
gamma = 1.4; syms A_ratio M eq1 = A_ratio == ((gamma+1)/2)^((gamma+1)/(2*(gamma-1)))*((1+(gamma-1)/2*M^2)^((gamma+1)/(2*(gamma...

4 years ago | 0

| accepted

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

Load more