Answered
Energy balance of stirred tank
syms rho cp V u A Tw T0 T(t) Tw(t) eqn = rho*cp*V*diff(T,t) == u*A*(Tw-T); cond = T(0)==T0; T = dsolve(eqn,cond)

4 years ago | 0

| accepted

Answered
Fitting differential equations using function file, error message "too many input arguments"
Runtime is too long, but seems to work in R2022 a. t = [0,0.5,1,2]; Gut = [1;2;3;4]; %No data inputted, doesnt matter Intesti...

4 years ago | 0

| accepted

Answered
fmincon computes always zero as a result
Yes, obviously J is minimized for u = 0 and arbitrary data.err vector. Do you expect something different ?

4 years ago | 0

Answered
How to calculate distance in the given question?
Use "pdist": https://de.mathworks.com/help/stats/pdist.html

4 years ago | 0

Answered
What dose this mean?
The easiest way to see what you are asking is to use the polar representation of a complex number. If z = r*exp(i*phi), then r ...

4 years ago | 0

| accepted

Answered
fminunc Converging at a strange point
xm = linspace(0,4*pi,10).'; ym = sin(xm); % initial parameter guess p0 = rand(1,8); % define objective function (scaled sum ...

4 years ago | 0

Answered
Calculate Negative loglikelihood of custom probability distribution
% Generate random numbers from chi distribution with k = 6 k = 6; y = rand(150,1); x = gammaincinv(y,k/2); x = sqrt(2*x); %...

4 years ago | 0

| accepted

Answered
Calculate Negative loglikelihood of custom probability distribution
Why don't you deduce the equation you have to solve for k by hand ? The paragraph Continuous distribution, continuous paramete...

4 years ago | 0

Answered
Make lsqcurvefit go through a defined point?
fun = @(out)((xdata(:,2).*(out(1)./(1+(xdata(:,1)./out(2))))) + (xdata(:,2).*(xdata(:,5)./(1+(xdata(:,1)./xdata(:,6))))) - (xdat...

4 years ago | 0

Answered
How to perform repmat function to repeat rows of a matrix
B = repelem(A,2,1)

4 years ago | 1

Answered
Solve ode in different interval
0.4*x*(1-x/k) instead of 0.4*x(1-x/k) and the variable k has to be set. st = 10; n = 20; c = 0.1; x0 = 0.5; p = [0.4, 1]...

4 years ago | 0

| accepted

Answered
Solve with several vectors
syms int_v_d_sym int_i_d_sym i_d_sym i_d1_sym int_omega_i_q_sym int_v_q_sym int_i_q_sym i_q_sym i_q1_sym int_omega_i_d_sym theta...

4 years ago | 0

| accepted

Answered
MATLAB Newton Raphson Method with a vector function
You have 7 equations for 4 unknowns. This won't give an exact solution, but only a solution in the least-squares sense. K=2.*ra...

4 years ago | 0

| accepted

Answered
Numerically solve equations with variables inside numerical integration
x = fsolve(@(y)tobesolve(y(1),y(2),y(3)),[0,0,0]) instead of x = fsolve(@tobesolve,[0,0,0]) And the function names must be in...

4 years ago | 1

| accepted

Answered
Index exceeds number of array elements
Insert class(fline) size(fline) after for i=1:nVal [fline,count] = fscanf (fid,'%f %f %f %f %f',5); and see what type...

4 years ago | 0

| accepted

Answered
How to use log scale with fimplicit
x = 0:0.1:1000; fun = @(x,y) cosh((log(2)*(x-1))./((x+1).*y)) - (1/2)*exp(log(2)./y); options = optimset('Display','none'); t...

4 years ago | 0

| accepted

Answered
ODE Event Function not Properly Configured
Always work with function handles instead of strings: options1 = odeset('RelTol', 1e-8, 'AbsTol', 1e-8, 'Events', @reaching_L...

4 years ago | 1

| accepted

Answered
Different outputs of ode solvers inside for loop
This code gives reproducible results; I don't know exactly why your code didn't work. matrix=zeros(90,2); %Model Trace; t...

4 years ago | 0

Answered
Iterative code sequence error
f1 = 1; f2 = 1; f3 = 1; n = 10; f = sequence(n,f1,f2,f3) function f = sequence(n,f1,f2,f3) if n < 4 disp('Choose b...

4 years ago | 1

| accepted

Answered
May I know the default tolerance of the ode45?
odeset

4 years ago | 0

Answered
How to get the discriminant for symbolic quadractice equation?
I guess you mean d = b^2-4*a*c if the polynomial is given by p(x)=a*x^2+b*x+c. So the a and b in the discriminant have nothing t...

4 years ago | 0

Answered
MATLAB CODE of an equation including Bessel's function
Here is a very similar problem solved: https://de.mathworks.com/matlabcentral/answers/1777535-infinite-sum-with-bessel-s-functi...

4 years ago | 0

| accepted

Answered
plot function of two variables as one variable
%% initialization clear clc close all %% Model parameters global k1 eta1 alpha3 gamma1 d N Phi xi h A B C G k1 = 6*10^(-1...

4 years ago | 0

| accepted

Answered
I want to do a stop condition in ode45 that he demands dx=0
AnonFun=@(t,x)(5*x-1*x^2); Opt=odeset("Events",@(t,x)myEvent(t,x,AnonFun)); [t,x]=ode45(AnonFun,[0,5],1,Opt); plot(t,x) func...

4 years ago | 0

| accepted

Answered
Double integration of an array function
"integral2" has no "ArrayValued" option - only "integral" has. But since the function comes from a "MatlabFunction" command, I ...

4 years ago | 0

Answered
T is not defined, dont know how to fix
After deleting the @ before ode23t, the code with @locO works for me. %ODEs n0=[0 0 0]; % Initial conditions options = odes...

4 years ago | 0

Answered
How to optimise the computation of multiple integral for a specific integrand?
Precalculate q over the hypercube on a predefined regular mesh and use "trapz" dimensionwise. Look at the example "Multiple nu...

4 years ago | 1

| accepted

Answered
substitution in symbolic.
syms s w assume(w,'real') f = s + s^2; fs = subs(f,s,1i*w); fs_real = real(fs) fs_imag = imag(fs)

4 years ago | 1

Answered
Fit chi distribution to measurement data
Square your measurement data, and you can fit them against a chi-squared distribution.

4 years ago | 0

| accepted

Answered
Calculating and plotting conditional distribution.
You mean this lambda = 0.3; p_bar = 1; p_tilda = (1 - lambda)/(1 + lambda); S = 0:0.01:p_tilda; n = 1000000; icount = 0; ...

4 years ago | 1

| accepted

Load more