Answered
An easy way to modify matrix elements?
for NCE = 1:NCEMAX if Failure(NCE) == 0 P(NCE,NCE+4:end) = 0 end if end

4 years ago | 0

Answered
A for loop where multiple variables depend on each other but change each iteration
Replace the loop by for k=0:10 P_i_new = R_Y*Y_i + R_A*A_i A_i_new = S_Y*Y_i + S_A*A_i Y_i_new = S_P*P_i P_...

4 years ago | 0

| accepted

Answered
How to solve a system of integro differential equation using numerical method?
Simple. Solve instead dx/dt = t*x(t) + exp(t)*u(t), x(0) = 1 dy/dt = t^3*x(t) + exp(-t)*v(t), y(0) = 1 du/dt = exp(-t)*y(t),...

4 years ago | 0

| accepted

Answered
Numerical calculation of nested integral with no analytical solution
function main R2=0.00012721; Ox = -8.39166666666673e-05; theta2 = 0.369784726547689; a = 0.000251315; D1 = 0.00024821; h1 = 0...

4 years ago | 1

| accepted

Answered
getting error while solving PDE using ode45
m=50; delx=1/(m-1); h_int=0.0005e7; final_time=1.0e7; N_samples=(final_time/h_int)+1; t0=0; tf=final_time; tspan=li...

4 years ago | 0

| accepted

Answered
iterate to reach the convergence
length = an estimate for the length; length_old = length + 1; while abs(length - length_old) >= 0.001 length_old = length...

4 years ago | 0

| accepted

Answered
I am trying to model a convective boundary condition on a 2D wall using FDM, but I keep getting an error in my convective BC, please help.
%% Given Tempertures T_t=300; %deg C T_b=200; T_l=100; T_inf=25; %% Given Thermal Properties h_inf=10; %W/m^2*K k_pcm=0....

4 years ago | 1

| accepted

Answered
how to simplify this system matrix ?
A=[B1 1;B2 1;B3 1;B4 1;B5 1;B6 1];

4 years ago | 0

Answered
Solving ODE using Euler Method and 4th Order Runge Kutta Method
function main tstart = 0.0; tend = 10.0; h = 0.01; T = (tstart:h:tend).'; Y0 = [-1 0 1]; f = @(t,y) [y(2) -y(...

4 years ago | 1

Answered
Does my for looop make sense?
for i = 1:numel(R) for j = 1:numel(a) ct(i,j,:) = R(i)*(1-exp(-a(j)*t)); end end plot(t,ct(1,1,:)) % plot ...

4 years ago | 0

Answered
I am trying to plot differential equations using ode45 and not getting a graph
function main IC = [93000;1000;1000;50;50;0;500]; tspan = [0 25]; [t,Y] = ode45(@odefun, tspan, IC); plot(t, Y) end ...

4 years ago | 0

| accepted

Answered
fsolve first-order optimality
Maybe this helps: https://comp.soft-sys.matlab.narkive.com/23U8N4sP/first-order-optimality-for-fsolve

4 years ago | 0

Answered
Unrecognized function or variable h.
syms me m gravity h eqn = me == h*m*g; Sval = solve(eqn,h); me_num = 2500; m_num = 5 ; gravity_num = 9.8; Sval_num = subs(...

4 years ago | 0

| accepted

Answered
How can I write the differential equation below?
With c1 = (b*omega + c*H)/L c2 = (a + d*omega^2)/L the solution Q(t) is Q(t) = (-c1 + (c1+c2*Q0) * exp((t-t0)*c2)) / c2 whe...

4 years ago | 0

| accepted

Answered
Index exceeds the number of array elements.
x = [25 10 10 12 10 25 13 25 25 11]'; x = sort(x,'descend'); [xc,xr] = groupcounts(x); xc = fliplr(xc); xr = fliplr(xr); ...

4 years ago | 0

| accepted

Answered
Is the following program correct
To avoid overflow in the x^i and factorial(i) terms, it is advisable to code it this way: n = input("no of terms"); x = input(...

4 years ago | 0

Answered
Subtracting one column in matrix 1 from each column in matrix 2
Dist = vecnorm(bsxfun(@minus,M_2,M_1(:,1))); for i=2:31 Dist = vertcat(Dist,vecnorm(bsxfun(@minus,M_2,M_1(:,i)))); end

4 years ago | 0

| accepted

Answered
i want to ask how can i store the value of d_eb for each iteration of loop
d_eb = sqrt((x_e - x_b(4,1)).^2 + (y_e - y_b(4,1)).^2); % distance without any loops.

4 years ago | 0

Answered
make a plot the sampling results
help barh

4 years ago | 0

Answered
Linprog gives a solution but one constraint is not satisfied (no notification)
I get x3(1) = 387,2108 x3(3) = 7,5211 x3(9) = 4,8920 x3(10) = 0.3761 and x3(i) = 0 for all other components. And this vect...

4 years ago | 0

| accepted

Answered
Include convolution integral inside ode function
Suppose you know the solution for velocity of your system of ODEs in 0*dt, 1*dt, 2*dt,..., n*dt. To calculate the solution in...

4 years ago | 0

Answered
Splitting matrix into fixed rows and N columns
M_new = M(1:30,:); For i=2:130 M_new = horzcat(M_new, M(30*(i-1)+1:30*i,:)); % M is your original matrix (3900 x 3) end...

4 years ago | 1

| accepted

Answered
Need help writing a code with a summation divided by a summation
a = [0.001, -0.014, 0.098, -0.424, 1.29, -2.96, 5.25, -7.35, 8.21, -7.3513, 5.25, -2.96, 1.297, -0.424, 0.098, -0.014, 0.001]; ...

4 years ago | 0

Answered
Find the divergence of a vector field f=xyi+yzj+zxk
https://de.mathworks.com/help/symbolic/divergence.html

4 years ago | 0

Answered
Problem - Optimization nonlinaer function
function r = myParFun(p,A,B,C,y) x = A*p(1).* exp( B*p(2)) .*exp( C*p(3)); r = myPearsonCoeff(x,y); %since optimizatio...

4 years ago | 0

| accepted

Answered
How to solve PDEs with only one side boundary conditions?
Discretize du1/dt and du2/dt in time (e.g. by backward Euler method): du1/dt @t=t_i+1 = (u1^(i+1)-u1^(i))/deltat du2/dt @t=t_i...

4 years ago | 0

Answered
I will buy labtop core i5 1135G with mx350 and ram 8 gb. Is that enough to run matlab r2020b or i should buy another laptop?
https://de.mathworks.com/support/requirements/matlab-system-requirements.html These are minimum requirements. You may choose m...

4 years ago | 0

Answered
Write a MATLAB code to Find the maxima and minima of two variable function f(x,y)=x^4+y^4-4xy+1
syms x y f(x,y) f(x,y)=x^4+y^4-4*x*y+1; dfx=diff(f,x); dfy=diff(f,y); eqns=[dfx==0,dfy==0]; vars=[x y]; S=solve(eqns,vars,...

4 years ago | 1

Answered
polynomial interpolation of satelite positions
Use interp1 for the three columns separately: t = 0:60; x = interp1(T,X,t); y = interp1(T,Y,t); z = interp1(T,Z,t); where T...

4 years ago | 0

Answered
Really am I simulation this system with ODE45? How am I can optimizing the code?
function main options = odeset('RelTol',1e-6,'AbsTol',1.0e-6,'Stats','on'); tspan = (0:0.1:8.9); %========================...

4 years ago | 0

| accepted

Load more