Risposto
function handle as array
M = rand(4,4); P_initial = rand(4,1); P = @(t) mtimes(expm(t.*M),P_initial); P(0) g = @(a,x)a(x); g(P(0),1)

3 giorni fa | 0

| accettato

Risposto
What does norm function indicate ?
From the MATLAB documentation: n = norm(X) returns the 2-norm or maximum singular value of matrix X, which is approximately max...

4 giorni fa | 0

| accettato

Risposto
My code is giving me a straight line for values of N other than 5
I'm quite sure that the 0.5 has to be taken out of the symsum: syms k N integer syms t y = 0.5 + symsum((cos(k*pi)-1)*(2/((k*...

4 giorni fa | 0

Risposto
Numerically integrate a time dependent differential equation
bP = 1; Te = 1; K = 1; t0 = 1; ti = 24; CDF = @(x)integral(@(t) 1/t0*exp(-bP./(Te^4+K*(307.59-190.96*(log(t/24)).^0.24)).^0...

4 giorni fa | 0

Risposto
Cant take the derivative of this plot...
m = 1; b = 2; k = 10; tnum = linspace(0,7,175); xlabel('0'); syms s F=1/(m*s^3+b*s^2+k*s); f=ilaplace(F); df=diff(f); v...

4 giorni fa | 0

Risposto
Could you please provide script to perform process described below. Many thanks in advance
A = rand(7) A = A(:,4) writematrix(A, 'A.txt')

4 giorni fa | 0

Risposto
Error message when trying to plot
T = K ./ sqrt(2*pi*w); instead of T=(K/(sqrt(2*pi*w)));

4 giorni fa | 0

Risposto
Multiple boundary conditions with two separate intervals
To use bvp4c, the two intervals have to be connected. Thus in your case, it's not applicable (or only with big effort). syms y1...

4 giorni fa | 0

Risposto
how to plot a periodic function?
a = 3.2; t1 = 5; t2 = 7; t3 = 12; t4 = 17; fun = @(x) a*(x>=0 & x<=t1) + (-a/(t2-t1)*(x-t2)).*(x>t1 & x<=t2) + (-a/(t3-t2)*...

5 giorni fa | 0

Risposto
How can I solve coupled nonlinear hyperbolic equations?
CLAWPACK available under https://www.clawpack.org/ is an excellent solver for hyperbolic systems of differential equations. A...

5 giorni fa | 0

Risposto
How to add integral in a integral function
format long integral(@(x)sin(integral(@(a)sin(a),0,x)),0,1,'ArrayValued',true) integral(@(x)sin(1-cos(x)),0,1)

5 giorni fa | 0

| accettato

Risposto
why while loop repeats so long?
If you output "count" for the numerical solution, it's about 14000. Now if you measure the time for one symbolic iteration in ...

5 giorni fa | 0

| accettato

Risposto
vector and for-loop issues in ode solver
%Parameters input.n=10; % # in r input.Ea=63000; % [J/mol] input.R=8.314; % [J/mol/K] input...

5 giorni fa | 0

| accettato

Risposto
Basis function regression for 3 parameters
Put the equations y(x1(i),x2(j),x3(k)) = a_0*f_0(x1(i), x2(j), x3(k)) + a_1*f_1(x1(i), x2(j), x3(k)) + a_2*f_2(x1(i), x2(j), x3...

5 giorni fa | 0

Risposto
Eigenvalues in symbolic matrix
Replace %% 2.stability analysis J=jacobian([gp(1)*vp(1)./(kp(1)+N0)*N*P1 - mp(1)*P1^2==0, ... gp(2)*vp(2)./(kp(2)...

5 giorni fa | 0

| accettato

Risposto
sum of Bessel function
m = 0:250; x = linspace(-5*pi,5*pi,1000).'; A = 2./((2*m+1)*pi).*besselj(0,pi/2*m).*sin(1000*(2*m+1).*x-(2*m+1)*pi/2); f = su...

6 giorni fa | 0

Risposto
Finite difference temperature distribution with TDMA
You solve the system iteratively. But you were told to solve it with the Thomas-Algorithm. So apply this algorithm to the matrix...

6 giorni fa | 0

| accettato

Risposto
How to solve a system of 8 equations having integrals!
d0 = ones(1,8); d = fsolve(@fun,d0) norm(fun(d)) function res = fun(D) d=1.18; E=27000000; L=121.53; I=(pi*d^4)...

6 giorni fa | 1

| accettato

Risposto
In fmincon I set the linear constraint x1+x2+x3=12, but the sum of decision variables in the iteration result does not meet the condition
Tighten your ConstraintTolerance, and you'll see that fmincon converges to an infeasible point for n=12 and n=13. 1st： (main.m)...

6 giorni fa | 2

| accettato

Risposto
unable to plot RungeKutta trajectory graph, potentially initial conditions?
Your code produces NaN values for z(1,:) and z(3,:), most probably caused by thetad and thetav. alpha = pi/4; tend = 2; v0 = ...

6 giorni fa | 0

Risposto
bvp4c/bvp5c error
Did you create a function with name "eps" ? Then you should rename it because "eps" is an internal MATLAB function.

7 giorni fa | 0

| accettato

Risposto
How to solve f'(x)=0?
You want to find x symbolically or numerically ? Numerically use "fzero". Symbolically use "solve".

7 giorni fa | 0

Risposto
Trying to find area under my plot
https://de.mathworks.com/matlabcentral/answers/514107-how-to-find-area-enclosed-by-a-closed-curve To get the positive and negat...

7 giorni fa | 0

Risposto
I want to use a matrix and a function to then create another function
theta1 = -50; theta2 = 30; theta3 = 15; theta4 = -75; theta5 = -45; theta6 = -60; DH = [theta1, 486.5, 150, -90;... ...

7 giorni fa | 0

Risposto
Solving system of 9 nonlinear equaitons in 16 variables
x0 = -10*ones(16,1); AB = [13 15 -1;9 24 0;7 2 35]; options = optimset('TolFun',1e-16,'TolX',1e-16); x = fmincon(@(x)fun(x,AB...

7 giorni fa | 2

| accettato

Risposto
the same value resulted from the linear optimization problem
You define w(k)=beta(k)*(-k_(k) *w_k(k)-k_(k)*log2(lamda(k)*(1-tau^2))*Pt + 2*k_(k)*log2(sqrt(segma_squared))-v_k(k)); and w...

7 giorni fa | 0

Risposto
Hello guys, I need to solve this system of nonlinear symbolic equation; the variables known are X,Y,Z and I already know the solution for q1; so I just need to find q2 and q3.
syms d1 d5 a2 a3 a4 q1 q2 q3 X Y Z % Square eq1 and eq2, add both sides of the equations and take sqrt % Check for other solu...

7 giorni fa | 0

| accettato

Risposto
What's the simplest way to determine the mass of a sphere from a plot of its density varying in r?
If r and rho are column vectors where r is ordered as r(1) < r(2) < ... < r(n) and rho is the density at position r, an approxim...

7 giorni fa | 2

| accettato

Risposto
Index exceeds the number of array elements. Index must not exceed 1.
Pb is a scalar. So Pb(ii) does not exist. You can use Fbump(ii)=Pb/VA(ii); %this line of code is givig me the error but I don...

7 giorni fa | 0

Risposto
Erro in calling function using horner()
I don't understand what you intend by using the lines [pz,b] = horner(a,x); [dpz,b]= horner(b,x); [pz ,a] = horner(a,x) The...

7 giorni fa | 0

| accettato