Respondida
Summing results at the end of a loop
x = linspace(0, 90.*(10.^-3), 100); w = [7.5.*(10.^-3),7.5.*(10.^-3),7.5.*(10.^-3)]; u = [(8.883).*(10.^-3),(8.883).*(10.^-3),...

alrededor de 2 años hace | 0

Respondida
calculate the normal of a 3D plane
I would like to know if it is correct to calculate the normal of this plane in the following way: N = cross(P(1,:) - P(2,:), P(...

alrededor de 2 años hace | 0

| aceptada

Respondida
"Empty sym" when solving a system of linear equations with different conditions
Your system only has a (nontrivial) solution if i = 1. In this case, the solution is given as below. syms Z1A Z2A Z3A Z4A Z1B Z...

alrededor de 2 años hace | 0

| aceptada

Respondida
Temperature profile in a pipe flow with Matlab pdepe solver
I corrected as much as I could, but the computation of Q looks different in your code in comparison to the article. %% Main cod...

alrededor de 2 años hace | 0

Respondida
Substitute partial differential into symfun
syms G(h) h(t) t Q = G(h) dGdt = diff(Q,t) % -> D(G)(h(t)) occurs s = children(dGdt) % Now define G(h) and derive: G ...

alrededor de 2 años hace | 1

| aceptada

Respondida
Using a loop to add rows to a struct, but the counter overwrites the rows.
I don't know how "trial" and "blockInfo" are organized. Here is one suggestion: for ifile = 1:3 for s = 1:nTrials struc...

alrededor de 2 años hace | 0

Respondida
I am trying to perform a simple operation FOR loop. I think I am not able to get the indexing right.
%% why does not the following operation work Because the numbers 1,2 and 3 in t1, t2 and t3 are not indices you can loop over, ...

alrededor de 2 años hace | 0

| aceptada

Respondida
Kelvin functions ker kei functions evaluation
The value kei(0) = -pi/4 only exists in the limit : syms x a = exp(pi*1i/4); limit(imag(besselk(0,a*x)),x,0,"right") limit(i...

alrededor de 2 años hace | 0

Respondida
constrained optimization with Matlab, symbolic function
If your function f is symbolic, you first have to convert it to a numerical function by using "matlabFunction". k_tot = ...; a...

alrededor de 2 años hace | 0

Respondida
I am unable to find the minimum value of function f in this optimization problem. The solver always returns 0 for all variables which is not possible. I am unable to correct.
The solution is correct: A*x <= b is satisfied, and since all elements in the f-vector are positive, 0 is optimal. Maybe you wa...

alrededor de 2 años hace | 0

Respondida
int function is not working properly in matlab
Evaluate gamma(n_star_D3(i)+l_d+1) gamma(n_star_D3(i)-l_d) and you will see the reason. Consequently, Gff_D3(i)...

alrededor de 2 años hace | 0

Respondida
Negative sign produced by "functionalDerivative" - why?
As you can see here at the bottom of the page https://uk.mathworks.com/help/symbolic/sym.functionalderivative.html functionalD...

alrededor de 2 años hace | 0

Respondida
fmincon get the wrong answer
Cost of buy with price 26 is 2*26 + c = 152 in your setting. Note that although you don't generate energy, Cg_i(0,a,b,c) = c - t...

alrededor de 2 años hace | 1

| aceptada

Respondida
Why the results of three codes with the same expression and method are different ?
Integrate equation (1) from x = 0 to x = x, and the problem will become much easier. dvdx0ini = 1; St = [0.1,0.5,1]; hold on ...

alrededor de 2 años hace | 0

Respondida
Curve fitting and parameter estimation with lsqcurvefit
% Load data data = readtable('infections.csv'); dates = datetime(data.Date, 'InputFormat', 'dd-MMM-yy'); cases = data.Cases; ...

alrededor de 2 años hace | 0

Respondida
How to set lower bound lb as a function of optimization variable.
Use function "nonlcon" to define nonlinear equality and inequality constraints. If v(i) depends linearly on the solution variab...

alrededor de 2 años hace | 2

Respondida
When using 'quadprog' how do I limit certain solutions so that they can only become whole numbers?
https://uk.mathworks.com/matlabcentral/answers/660423-can-i-solve-mixed-integer-quadratic-programming-miqp-problems-in-matlab-us...

alrededor de 2 años hace | 0

Respondida
Synthax for equation in script
r0 = 3; r1 = 4; delta = linspace(-r0,r0,31).'; k = linspace(-r1,r1,31).'; 0.5*sqrt((delta+k.^2).^2+4*k.^2)

alrededor de 2 años hace | 0

Respondida
Equal arc discretization method code
warning("off") syms t t1 t2 % Parameters R2 = 12; %outer radius (between this radius and R1 is constant arc increment) b = 2...

alrededor de 2 años hace | 0

Respondida
A quatity is being solved by a self consistent integration
format long syms x A = 2000; a = 500; b = 1000; Z = 0; for i=1:20 f = x^4*((A^2+Z^2)/(A^2+4*(x^2+a^2)))^4 / (sqrt(x^2+...

alrededor de 2 años hace | 0

| aceptada

Respondida
How can I write the term \sum_{q=1}^{m} b_{pq}(t)g_q(y_q(t-\tau_{q}(t))) to produce the same graph
I don't know exactly what you are asking for, but if it's about solving Equation 1, you will have to use a solver for delay diff...

alrededor de 2 años hace | 0

Respondida
Non linear fitting with 3 independent variables
M = load("Data.mat"); fun = @(A,B,C,E)(A - B*M.IL - C*M.a).*exp(-E*M.Vf); f = @(A,B,C,E) fun(A,B,C,E) - M.K; A0 = 13.5*13.2; ...

alrededor de 2 años hace | 2

Respondida
Finite Difference Method - Central Difference Method for Groundwater Flow Problem
It would help if you included the mathematical description of your problem in order to compare with your coding (equation(s) to ...

alrededor de 2 años hace | 0

| aceptada

Respondida
How to return a vector output when a vector input is given to a function_handle representing a constant function?
This works in both cases: % Usual Case syms x; syms t; u = symfun(x^2,x); u_x = diff(u,x); u_x = matlabFunction(u_x); u_...

alrededor de 2 años hace | 0

Respondida
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Only a single number can be saved in an array element. But you try to save a vector ([a b(i) c 0 0 0 0 0 d(i)]) in a single e...

alrededor de 2 años hace | 0

| aceptada

Respondida
Runge Kutta 4th Order Method for an Equation
Write a function function dy = f(t,y) that accepts t and a vector y of length 2*n with y = [c_1;...;c_n,cbar_1;...;cbar_n] ...

alrededor de 2 años hace | 1

Respondida
How can I calculate the integral of Legendre function P(n,theta) ?
The Legendre function is a numerical, not a symbolic function in MATLAB. Further, it's define for -1 < x < 1. So integration f...

alrededor de 2 años hace | 1

| aceptada

Respondida
Plotting discrete Klein - Gordon equation (DKG) with friction in DNA
acceleration(1) = acceleration(numBases) = 0 for every value of i in your loop. From the equation initialVelocities = initia...

alrededor de 2 años hace | 0

| aceptada

Respondida
Trying to solve system of PDE by spacial discretization. Errors are coming frequent . what am i doing wrong ?
Technically, your code works now. But you get NaN values for some dydt's. The reason might be that you start with a complete 0 v...

alrededor de 2 años hace | 0

| aceptada

Respondida
I need help with an error I get
Define F before you call "funcao_forca". It's not set in your code. Maybe you mean F = funcao_forca(t,f); because f is a give...

alrededor de 2 años hace | 1

Cargar más