Answered
Hello , I am dealing with linear least square regression
y = Q*x^M => log(y) = log(Q) + M*log(x) Thus take "log" of your x- and y-data and fit them by a linear function y~ =...

8 years ago | 0

| accepted

Answered
Problems in the implementation of ODE45 in an epidemiological problem SIR
function ypsir = ypsirtry(t,y) betah = .01; muh = 0.01; sigmah = 0.05; alphah = 0.06; deltah = 0.05; mui = ...

8 years ago | 0

| accepted

Answered
ODE15s time vector size
If t_span has more than two elements, the ode integrator will output the solution at exactly the specified time instants. Bes...

8 years ago | 0

Answered
How to plot a symbolic function with an intergral
a=8; b=0.1; c=100; q=@(tf)c-a/b*(1-exp(-b*tf)); tf=0:0.1:1; plot(tf,q(tf));

8 years ago | 0

Answered
Cubic Interpolation function help?
help interp1 with the "spline" option for interpolation. Best wishes Torsten.

8 years ago | 0

Answered
Initial Conditions aren't being used/applied for Plotting System of Differential Equations
[t,y]= ode45(@(t,y)Chowattempt6(t,y,s,r,k1,md,pc,a,k2,k3,cd,pa,ad,g,bd),tspan,y0,options); Best wishes Torsten.

8 years ago | 0

Answered
How can I calculate Tc and CE, when both the variables are interdependent?
Linear System of equations for Tc and CE (2 equations for 2 variables). Use Cramer's rule or \ to solve. Best wishes Torst...

8 years ago | 0

Answered
Hi,I want to multiply 4 dimensional matrix with a column vector.Can anyone help me how to do this?
Select the one or two-dimensional submatrix from the four-dimensional matrix with which you want to multiply the column vector. ...

8 years ago | 0

Answered
How can I repeat a cycle in a for loop with n samples
t=Tstart; n=1; cycle=1; flag=0; while flag==0 if t<Ti Pmus(n,cycle)=A*(t/Ti); Pm(n,cycle)=5...

8 years ago | 0

Answered
How to create a piecewise function using if and else statements?
x = -5:5 for i=1:numel(x) if x(i) <= -3 y(i) = -x(i) -3; elseif (x(i) > -3) && (x(i) < 0) y(i) = x(...

8 years ago | 3

Answered
How can i do decimal increment in for loop starting from 0
t=0:0.5:2; p2 = 3*t.*(1-t).^2

8 years ago | 0

| accepted

Answered
what will the boundary(both side insulated) nodes equations be? please I need help in any way possible
Your equation is a first-order PDE with only a convection, but no conduction term in it. Thus you cannot prescribe insulated bou...

8 years ago | 0

Answered
How can I create an array with a for loop?
A = zeros(1,71); n = -50:20; A = power(0.8,n)

8 years ago | 2

Answered
How can I evaluate this Fourier-transform?
b=30; c=1; fun=@(t,w)exp(-t.^2/(2*c^2)+1I*b*exp(-t.^2/c^2)).*exp(1I*w.*t); q=@(w)integral(@(t)fun(t,w),-Inf,Inf,'Arra...

8 years ago | 0

Answered
how to solve a linear system with a maximum function
syms x y [solx, soly] = solve([x+y==1,piecewise(x>y,x,y)==2],[x y]) Best wishes Torsten.

8 years ago | 0

| accepted

Answered
Problem using lscurvefit - 'Initial point is a local minimum'
Try to fit 1/kdim against the inverse of your function f. After rearranging you'll see that 1/f takes the form 1/f = f1...

8 years ago | 0

Answered
Fsolve for different values of a parameter
Call fsolve in a loop and change the value of rho in this loop according to your needs. Save the results for (theta, eseuil, u ....

8 years ago | 0

Answered
How to use fmincon with non-linear constraints that are dependent on the objective function output?
By writing a function "noncons" and calling the objective function from within "noncons" to get "T_max_sim_lst". Best wishes ...

8 years ago | 0

Answered
Matlab systems of differential equations solution using syms
syms X Y s %Laplace transform eq1 = s*X+4*s*Y-X==s/(s^2+1); eq2 = 3*s*X+s*Y==0; [solX solY] = solve([eq1 e...

8 years ago | 1

| accepted

Answered
how to solve a definite integral that contains a variable same as that of one of its limits
q = 1.6*10^-19; epsi = 12.47*10^-12*8.85; Dd = 5*10^-9; Di = 5*10^-9; a = 0.125*10^-20*1.6*10^-19; z = 100*10^-...

8 years ago | 0

| accepted

Answered
MATLAB Plot Function For Sum of Series Problem
summe = zeros(11,1) for k= 1 : 1 : 10 summe(k+1) = summe(k) + ((((-1)^(k+1))+1)*cos(k*pi)); end result = summe ...

8 years ago | 0

Answered
Regression of 4 variables: 1 as functions of 3
Forget about an empirical equation; use interpolation directly: https://de.mathworks.com/help/matlab/ref/scatteredinterpolant...

8 years ago | 0

Answered
Adsorption Modelling - Solving PDE - Axial Dispersion Model
The code I provided here for a very similar problem might help: https://de.mathworks.com/matlabcentral/answers/371313-error-i...

8 years ago | 3

| accepted

Answered
Fitting 3d data
I suggest you interpolate directly from the data: https://de.mathworks.com/help/matlab/ref/scatteredinterpolant.html Best ...

8 years ago | 0

Answered
Calculating interest rate in bonds
C = ...; M = ...; n = ...; Bond_price = ...; fun=@(i)C*(1./(1+i)-1./(1+i).^(n+1))./(1-1./(1+i)) + M./(1+i).^n - Bo...

8 years ago | 1

| accepted

Answered
fminsearch for multi-input and single output
Ymes = rand(3000,3); x1= rand(3000,3); x2 = rand(3000,3); Ymes = Ymes(); x1 = x1(); x2 = x2(); fun = @(p) su...

8 years ago | 0

Answered
Why am I getting an error that matrices must agree?
L = (Area - 1/2*pi*R.^2)./(2*R); Best wishes Torsten.

8 years ago | 1

Answered
I've got a wrong answer on subtract Matrices
https://blogs.mathworks.com/loren/2016/10/24/matlab-arithmetic-expands-in-r2016b/ Without further comment on the usefulness o...

8 years ago | 0

| accepted

Answered
Errors using ODE45: "Output of the function must be the same size as the input"
Try M=@(t,Y)[Y(2); -integral(@(z1)integral(@(z2)(exp(-z1.^2).*exp(-z2.^2).*tanh(z1.*sqrt(Y(1).^2.*(-2.749426546736005e1)+3....

8 years ago | 0

Answered
Fitting a linear sine curve with polynomial curve
x=linspace(0,2*pi,100); x=transpose(x); A=[ones(numel(x),1),x,x.^2,x.^3,x.^4]; b=sin(x); sol=A\b; % Polynomial is...

8 years ago | 0

| accepted

Load more