Réponse apportée
How to use a user defined function inside the curve fitting function?
Use "lsqcurvefit". There are lots of examples under https://uk.mathworks.com/help/optim/ug/lsqcurvefit.html that show how to ...

plus de 2 ans il y a | 0

Réponse apportée
Why does the vectorized function give wrong result?
Compare Fun1 and Fun2. In Fun1, xo is computed using u while in Fun2, both xo and xe are computed using b. Further, the sorting ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
what happens behind "/"
If x = [2 3 4 5 6] and y = [3 4 5 6 7], then x/y determines the number "a" for which the error when approximating x by a*y is mi...

plus de 2 ans il y a | 2

| A accepté

Réponse apportée
The function is debugging too long...
But the secant method is very different from your code - something like this: clc, clear all, close all x1=linspace(-pi/2,p...

plus de 2 ans il y a | 0

Réponse apportée
solving system of equations
I wonder what you expect as solution for 1 equation with 7 unset parameters. Say you have the equation g = x + c1 + c2 + c3 +...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Error using plot for Fourier series
I'm not sure what you try to do. Maybe something like this: clear all syms x L = 2; f = piecewise(x<=L/2,x,x>L/2,(L-x));...

plus de 2 ans il y a | 0

Réponse apportée
How to vectorize the following piece of code by removing the two for loops?
clear all;clc u=[3 4 30 50];% Desired Vector b=u; [R,C]=size(b); P=C/2; M=2*C; k = (1:M).'; i = (1:P); xo = sum(1*exp(1i...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
how to express operators in symbolic algebra
Maybe like this syms x syms P(x) q(x) q(x) = x^2 P(x) = diff(q(x),1) + 5 ? You can't define P as a function of a dependen...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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(...

plus de 2 ans il y a | 0

Réponse apportée
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 ?

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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 = ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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 ...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
求救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...

plus de 2 ans il y a | 0

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 0

Réponse apportée
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 ...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 1

Réponse apportée
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...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 2 ans il y a | 1

Charger plus