Answered
what is different between the codes?
In both cases, you want to solve one equation in three symbolic variables (x,K,M). In your first code, MATLAB is able to determ...

2 years ago | 0

| accepted

Answered
How can I fix this problem?
You call "fsolve" with a vector of initial values of length 4, but within your function fonk1, you expect a vector x of length 5...

2 years ago | 0

Answered
how i could let the graph be at zero and then start at a specific point like this ? (yellow heighlight)
P1 = [-2;0]; P2 = [-0.5;0]; P3 = [0.5;0]; P4 = [2;0]; t = -0.5:0.001:0.5; ft = sin(t*22*pi); plot([P1(1),P2(1),t,P3(1),P4(...

2 years ago | 0

Answered
Standard deviation error bars for each interpolated value of temperature
You mean the graphics if you add the line errorbar(xq,average_vq_10,err_10,"blue") at the end of your code from above ?

2 years ago | 0

Answered
numerical solution for heat equation
I think your discretization should be done using the FV-method. Here, the volumes and areas of the bricks - expressed with dx, d...

2 years ago | 0

| accepted

Answered
Precision of intersecting a ray with a cylinder without symbolic expressions
w_c = 0.15; %width of the cylinder h_c = 0.15; %height of the cylinder P_0 = [0;0;h_c]; %starting point of the ray for i = ...

2 years ago | 0

| accepted

Answered
How can I illustrate the objective function and their constraints in function file?
I'm sure you can use a loop to define the constraints, and I'm sure you will find out how. C = 5; S = 3; N = 6; prob = optim...

2 years ago | 0

Answered
In an assignment A(:) = B, the number of elements in A and B must be the same. Error in Skeleton_Code_Problem_11 (line 152) y(n+1) = y(n) + dt*(-y(n) - ACE + (PE1 + PE2
Use %Calculating ACE ACE = B*(((w1(n)-ws) + (w2(n)-ws) + (w3(n)-ws))/3); instead of %Calculating ACE ...

2 years ago | 0

Answered
Need help to make a ode function asign a value
A,,B,C,D,E,rho and n are undefined. And you must supply V to your ode-function using [tn,xn] = ode45(@(t,x)tempo_SysEDO_NL(t,x...

2 years ago | 0

Answered
2D Interpolation/Extrapolation on Irregular shaped grid
In order to use "interp2", you must specify a rectangular region where values of your function are given on a regular grid. Thus...

2 years ago | 0

Answered
Is there anyway to increase the calculation speed of this sqrt integral2 without loosing accuracy?
The solution of the 2d-integral via an ode problem is adaptive and fast. It's somehow like applying iterated "trapz", but adapt...

2 years ago | 0

Answered
why does the following code give error?
Use xo(1,k)=xo(1,k)+1*exp(1i*((-pi/2)*sin(u(P+i))*(k-1)+(pi/(16*u(i)))*cos(u(P+i))^2*(k-1)^2)); xe(1,k)=xe(1,k)+1*exp(1i*((k...

2 years ago | 0

| accepted

Answered
Ode15s , Plotting issue.
Choose less output times from the solver, e.g. by setting tspan = linspace(tcut(i), tcut(i+1),(tcut(i+1)-tcut(i))/10) inst...

2 years ago | 0

Answered
CasADi Integrator setup for transport equation
With a velocity of 100 and a length of 4 for the region of integration, it takes at most 4/100 sec until "rho" gets constant and...

2 years ago | 1

| accepted

Answered
求救TT HELP WITH THE PDE error (too many input arguments)
If you transfer inputs to the pdepe functions by c = pdepe(0,@slowsorpde,@slowsorpic,@slowsorpbc,x,t,options,... D,v,theta...

2 years ago | 0

Answered
How to fit the parameters of a custom curve that includes integration and series summation
The solver will supply trial values for the unknown parameters. So you "only" need to write a function that - given hw and value...

2 years ago | 0

| accepted

Answered
How do I avoid the mistake?
x in your code is a scalar, not a vector. Thus something like x(k) does not exist. You could work with xold and x where xold wo...

2 years ago | 1

| accepted

Answered
Calculate a numerical value for the Conditional Tail Expectation (TVaR) at probability level 0.9 for the inverse Gamma distribution with parameters α = 3, and θ = 50, 000
syms x alpha = 3; beta = 50000; f = beta^alpha/gamma(alpha) * (1/x)^(alpha+1) * exp(-beta/x); F = igamma(alpha,beta/x)/gamm...

2 years ago | 0

Answered
Coordinate Conversion Equation Solution Issue
Here is a partial solution, but note that equation1_transformed and equation2_transformed are not satisfied for all values of t ...

2 years ago | 1

Answered
Data fitting using implicit functions and infinite series
Depending on the number of series terms you want to use in the evaluation of J, determine the roots of the nonlinear equation ta...

2 years ago | 1

Answered
Index exceeds the number of array elements, must not exceed 1, in a nested for loop
Use clear clc % givens for the air ma = 15; %kg/s Tai = 1200; % deg-C cpa = 1.207; % kJ/kg-K @ 1200C ODa = 0.05; % m ID...

2 years ago | 0

| accepted

Answered
finding maximum power using a single-objective optimization algorithm
You want to minimize -f. Thus instead of % Store best fitness of the generation fitnessHistory(generation) = max(fitness); yo...

2 years ago | 1

Answered
How to solve a system of exponential equations?
Simply define your equations as function handles, not as symbolic expressions: f = @(a,b,c) [-1*((11.5*exp(0))+(11.3*exp(b*5))+...

2 years ago | 2

| accepted

Answered
Solving the system of ODEs and algebraic Equation
As you can see, your algebraic equation does not seem to have a zero for your initial vector for the other variables. Further t...

2 years ago | 0

Answered
Plotting is not quie correct
Maybe for i = 1:lengthT for j = 1:length_L term1(i,j) = C2./(lambda(j)*T(i)); E(i,j)= C1./((lambda(j)^5)...

2 years ago | 0

Answered
keep getting an error message
x is a 2x4 matrix. So as soon as node1 or node2 in the lines % Calculate the cosine and sine of the element angle dx = x(node...

2 years ago | 0

| accepted

Answered
How to plot the graph for the given RK 4th order step method
f=@(t,x)(13950-x)/18.75; x0=560; t0=0; t=15; h=1; X(1) = x0; T(1) = t0; for c=1:15 k1=h*f(t0,x0); k2=h*f(t0+(h/2),x0+...

2 years ago | 0

Answered
How can obtain the probability density function for a random discreate set of data and fit a custom distribution function ??
Use "histogram" to plot the empirical probability density function for your data and use "mle" to estimate n. https://uk.mathwo...

2 years ago | 1

Answered
How to create vector with elements which are matrices?
A cell array might help: M{1} = [3 5;9 12]; M{2} = [2 -9;0.6 -3.7]; M

2 years ago | 0

Answered
how to incorporate boundary conditions as constraints in fmincon optimization?
I think with the mixture of numerical, symbolic and optimization variables it is easier to set up the problem directly. x0 = [ ...

2 years ago | 0

| accepted

Load more