Answered
Find the roots of a complicated expression
syms x expr_orig = -190 + 100/(1+0.01+x) + 80/(1+0.02+x)^2 + 20/(1+0.03+x)^3; expr = expr_orig*(1+0.01+x)*(1+0.02+x)^2*(1+0.03...

4 years ago | 0

Answered
How can I get output in terms of x and y?
syms u v x y z S = solve([x==u+v,y==exp(v)],[u v]) x = u+v; y = exp(v); z = log(x^2-2*y); dz_du = diff(z,u) dz_dv = diff(z...

4 years ago | 1

| accepted

Answered
I can not solve 6e quation 6 unkonwn problem.
You have a linear system of equations in the unknowns T1,T2,T3,T4,T5 and T6. So you can put it in the form A*T = b with a 6x...

4 years ago | 1

Answered
Fourier Series Expansion of a Periodic Square Wave
n = 49; fun = @(t) 4/pi*sum(sin((1:2:n)*t)./(1:2:n)); T = linspace(0,2*pi,100); X = arrayfun(fun,T); plot(T,X)

4 years ago | 0

Answered
5 equations in 5 unknowns with fsolve
This code starts running although producing Inf and NaN values: function main P0 = rand(5,1); P = fsolve(@myfun,P0) end f...

4 years ago | 0

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

Load more