# Torsten

Last seen: Today Active since 2013

Followers: 10   Following: 0

#### Feeds

View by

How do I construct marices of multiple variables and plot a graph
tspan=[0 3]; x0=100; y0=0; z0=[x0;y0]; [tSol, zSol]=ode45(@odefun,tspan,z0); plot(tSol, zSol); function dzdt=odefun(t,z) ...

5 hours ago | 1

I don't know what this means
Most probably, you don't have write permission in the directory to which you want to unzip 'MerchData.zip'.

6 hours ago | 0

Coupled ODEs by ode45 and could not get the figures
% Initial conditions Y0 = [298; 0.75; 0.04; 0.015; 0.0331; 0]; % [T0; Xa0; Xc0; Xs0; Z0; Soc0] % Time span tspan = [0 3000]; ...

2 days ago | 1

Can integral2 left a variable inside?
@Guan Hao You cannot simply remove the w in your expression as suggested by @Umar. I'd do the general integration first and the...

2 days ago | 0

| accepted

A numerical calculation problem leading to Inf or NaN in matlab
log2(norm(x,lambda)) does not work ?

3 days ago | 1

Hello all, kindly, I have question , how can I get the piecewise function of this blood flow rate shown below using Matlab
T = 0.56; A = 220; fun = @(x)A*sin(2*pi*x/T).*(x>=0 & x<=T/2) + 0*(x>T/2 & x <=0.7); F = @(x)fun(mod(x,0.7)); x = linspace(0...

3 days ago | 0

| accepted

calling function from separate document for fitting
However, when I try to call script 1 from 2, I get a ton of error messages. Could I please ask why is this the problem? You ca...

4 days ago | 0

| accepted

Setting bounds for constants in a fit() object in terms of other constants in the fit object
Use "lsqcurvefit" and set A(1,2) = -1, A(1,3) = 1/min(x) and b(1) = 0 for the linear constraint condition A*x<=b.

4 days ago | 1

How store evolution of x over the iterations of lsqnonlin?
If you can't use the nested approach, define "history" as a persistent variable and call "myoutput" after the computation has fi...

5 days ago | 1

Something doesn't work for me in fit
hist_x=[10 30 50 70 90 110 130 150 170 190 210 230 250,... 270 290 310 330 350 370 3...

5 days ago | 0

simplify and reorganize symbolic expression
The only symbolic function that comes to mind is "coeffs". If this function does not do what you want, I fear you are lost here....

7 days ago | 0

| accepted

help with bvp4c error
Use solinit = bvpinit(x_init,[1 1 phi_c 0]); instead of solinit = bvpinit(x_init,[1 1 phi_c 0],w); Why did you use the w-pa...

7 days ago | 0

Index in position 1 is invalid. Array indices must be positive integers or logical values Error
Array indexing in MATLAB starts with 1, not with 0. But you try to set Pdata(0)=pressure01(0,1); in your nested loop for i = ...

8 days ago | 0

Is this a correct way to use fsolve?
Solve in w^2 instead of w - then there shouldn't be imaginary parts in the solution: F = @(w) ((1-p)/C)*(kappa^q - (w^2)^q)+y+z...

8 days ago | 1

| accepted

Performing Newton's divided difference and trapezoidal rule in one program
I don't know if this is what you want. Your code is very badly structured and hard to follow. Shouldn't x=[2 4 6 8 10 12 14 1...

9 days ago | 0

| accepted

why am I getting this difference in the plotting?
Your choice of a and b must be different from the values you posted: % First method a = 3; b = 0.9; x0 = 0.9; y0 = 1-x0; f...

9 days ago | 0

| accepted

help solving for Delx
qf = 38.6; T1 = 25; e=0.95; s=5.67e-8; K=300; t=0.12; w=3; fun = @(T,delx) [T(1)-T1; qf - K*w*t/delx*(T(1)-T(2)) - 2...

11 days ago | 0

| accepted

problem doing implicit plotting
Remove the dot at the end of the expression x.*y.

11 days ago | 1

Why i am getting blank graph? Can someone help me to figure out error in my code.
is_exam3() function is_exam3 L=0.01; M=0; q=0.5; a=0.03; Pr=0.1; b=0.2; p=0.1; m=0.1; e=1.0; H=0.1; E=0.1; o=0...

11 days ago | 0

How to solve the following PDE equation
I think you mean x(s,0) = 10 instead of x(s,t) = 10, don't you ? The easiest way to solve the equation is to discretize the exp...

11 days ago | 0

| accepted

Matrix is singular to working precision.
Obviously, your matrix is the zero matrix. Most probably the reason is that you don't assign values to K in the loop K(2*cnt-1...

12 days ago | 0

Solving unknown matrics to the power 20
p = [1 0 0 0 0 0 0]; R = [9; 8; 7; 6; 5; 4; 3]; CR = [0.45]; n = 20; TPM = diag([(CR/(p(1)*R(1)))^(1/n),zeros(1,6)]); p*TPM...

13 days ago | 0

Error using pdepe: Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative
"pdepe" is a solver for parabolic-elliptic equations. Thus all equations should have a second-order derivative term in space and...

13 days ago | 0

| accepted

In matlab, although my matrix is ​​full rank, the solution is still incorrect.Ax=b,A(10000*10000),x、b(10000*1)
The condition number of your matrix D is around 1e11 (see above). This is near to singular. I think you cannot expect a better r...

13 days ago | 1

Too many input arguments error
Your function xa and xn have three inputs (n,x,g), not two (n,g). Thus x_func = @(n, g) (xa(n, g)/xn(n, g))^(1/3); % Example T...

13 days ago | 0

solving symbolic equations with partial derivatives
syms Cf(zf,zr) cf(z,theta) L zref = zf; thetaref = (zf - zr)/L; dCfdzf = diff(cf,z) * diff(zref,zf) + diff(cf,theta)*diff(the...

13 days ago | 0

Calculations with distributions of variables only
Look up "Monte-Carlo-Simulation".

14 days ago | 0

Time-dependent dynamic problem with nonlinear stiffness using ode45
You solve for U and Udot - thus you get values for U and Udot from ode45. Simply compute the matrix K(U) with these values and p...

15 days ago | 0