Answered
solve Nonlinear PDE and compare the analytical and numerical solutions
In the recursion % Implementation of the Crank-Nicholson method for j = 1:Nt u(2:Nx,j+1) = inv(MM...

4 years ago | 1

| accepted

Answered
How can I solve the italicized equation for the matrix gamma_e, gamma_s and d1 ?
syms x y d dvals = 0.9:-0.1:0.1; num_d = length(dvals); EU_e = zeros(num_d,1); EU_s = zeros(num_d,1); xvalue1 = zeros(num_d...

4 years ago | 0

| accepted

Answered
The professor asked to remake the C++ code in MATLAB.
Don't know if this is what you want: nnucl = 1; nH = 10.^-7; nH2 = 10.^-3; nHp = 10.^-2; nOI = 10.^-8; ne = 10.^-2; kb ...

4 years ago | 0

Answered
Creating a fourbar mechanism with certain constraints
You can just delete this line because the FP in your call to "fmincon" is only a formal parameter.

4 years ago | 0

Answered
Replacing a row of the matrix as a function?
temp = [1 2 3; 4 5 6; 7 8 9]; fun = @(x)[x, 2*x, 3*x]; temp = @(x)[temp(1,:);fun(x);temp(3,:)]; temp(4)

4 years ago | 0

Answered
plotting graph using symbolic equation
From what you wrote, there is no relation between f and Avh. Can you write down Avh as a function of f so that - given numerica...

4 years ago | 0

Answered
who does logical works
The even elements of the x-vector are multiplied by a factor of 5, the odd elements remain unchanged.

4 years ago | 0

Answered
How to plot PDF of X if X= rand and PDF of X if X= rand-0.3. Do I have to use pdf function for this?
If you don't know by looking at the formulae for X what the respective PDF is, use a Monte-Carlo simulation: X = rand(10000,1);...

4 years ago | 0

Answered
I want to plot a function that is defined implicitly as a bound of integration of an integral equation.
p = 10; N = 3; m = 2; f = @(x) 1/sqrt(2*(N-2))*1./sqrt(p/N*(x.^(-N)-1)-1/(N-m)*(x.^(-N)-x.^(-m))); T = 0:0.01:0.3; r0 = 0.5...

4 years ago | 0

| accepted

Answered
Index exceeds the number of array elements (11819)
Error message seems clear to me: The arrays slip_angle_front_outer slip_angle_front_inner slip_angle_rear_outer slip_angle_...

4 years ago | 0

Answered
I need a function which returns 0 if the argument is negative
g = @(x) (x > 0).*f(x)

4 years ago | 0

Answered
calculating size of column with specified value in the column
DDDx = zeros(50,1); for i = 1:50 DDDx(i) = numel(e1(e1(:,2)==i)); end

4 years ago | 1

Answered
Symbolic differentiation for very long equation
Here is a code to test MATLAB's answer: syms ua us g R rho D = 1 / sym('3') / (ua + (1-g) * us); z0 = 1 / (ua + (1 - g) * u...

4 years ago | 0

| accepted

Answered
File: bvpfcn.m Line: 1 Column: 23 Invalid use of operator.
In principle, this is a direct copy of the first example for bvp4c in the MATLAB documentation. You only had to give different ...

4 years ago | 0

Answered
Newton Raphson Liquid-liquid extraction
No sum constraint on sum_i xi ? n = 8; x1space = linspace(0,1,n); xresp = zeros(1,n); Tresp = zeros(1,n); %for i = 1:n i...

4 years ago | 0

Answered
Trying to use ode45 to solve a second order differential equation with time dependent parameters
Results as expected ? %This is the ODE45 code. function project_anglefunction close all clc % using ODE45 to solve fo...

4 years ago | 0

Answered
Symbolic Paramaters Not Supported in Nonpolynomial Equations
Use an ODE integrator (e.g. ODE45) to solve dU/dt = -Fd(t)/m_sat * v_inf/U - g*sqrt(1-(v_inf/U)^2) - q(t)*W (1') dW...

4 years ago | 0

Answered
fmincon - penalty function
As far as I can see, you could formulate your problem as min: sum_i (abs(demand(i)-P(i))) s.c. Pmin <= P(i) <= Pmax 0 <= V_l...

4 years ago | 0

| accepted

Answered
The exponential integral (expint) of x is defined as E1, then how E2 is defined ? Can it be solved using MATLAB?
Why do you ask the same question again ? It has been answered here: https://de.mathworks.com/matlabcentral/answers/1665879-how...

4 years ago | 0

| accepted

Answered
decic error in DAEs which the equtions contain the difference scheme of state variables
The delta expressions are not acceptable since the ODE solver you chose varies stepsize in each integration step. You will have...

4 years ago | 0

| accepted

Answered
Optimization running. Error running optimization. Your fitness function must return a scalar value.
I can't decipher from function "opt" what you are trying to minimize. But anyhow: your c has dimension 1x8, but it has to be 1x...

4 years ago | 0

Answered
Polynomial fit with centering & scaling
Another option: xy = [ 1508.936 19.2189 1509.159 54.27226 1509.472 102.8022 ...

4 years ago | 0

Answered
How to generate correct sine wave
fs = 500; t = 0:1/fs:1-1/fs; x = sin(2*pi*10*t); plot(t,x) Better ?

4 years ago | 0

Answered
Unrecognized function or variable 'A'. Error in ode89vsrk (line 37) plot (t,A,x,Y(:,1))
%% ODE89 A0=1; B0=3; P0=0; K=5*10^-5; Yb=1; Yp=0.15; xM = [0 43200]; fyt = @(t,y,K,Yb,Yp) [(-K*y(1)*y(2)); (-Y...

4 years ago | 1

| accepted

Answered
how to find the correct value of the matrix
into = zeros(10,1); into(1:3)=x(1:3)*d(1); into(4:7)=x(4:7)*d(1); into(8:10)=x(8:10)*d(1); or simply into = x*d(1); You ca...

4 years ago | 0

Answered
Polynomial fit with centering & scaling
Here is an example that shows how to proceed: x = [1,2,3]; y = [4,9,25]; order = 1; p = polyfit(x,y,order); [p1,S,mu] = p...

4 years ago | 0

Answered
finding variables in polynomial expressions
A = [0 -83.33; 500 -10]; B = [166.67; 0]; C = [0 1]; K = @(k1,k2)[k1 k2]; A2 = @(k1,k2,ke) [A-B*K(k1,k2) B*ke; -C 0]; a ...

4 years ago | 0

Answered
solve a system of nonlinear equations + partial derivatives
I would like to solve a system of nonlinear equations which contains equations with partial derivatives If you evaluate dr/dx, ...

4 years ago | 0

Answered
How to define a variable as a condition of other variables
dTSI = r^2*SBC*4*T^3*dT/L^2 dT = dTSI*L^2/(r^2*SBC*4*T^3) dT/dTSI = L^2/(r^2*SBC*4*T^3) Thus in MATLAB: r = ...; SBC = ...;...

4 years ago | 0

| accepted

Answered
how to get the contour/shape of a representation in 2D?
https://de.mathworks.com/help/matlab/ref/convhull.html [k,~] = convhull(P); plot(P(k,1),P(k,2)) with P being your points as a...

4 years ago | 0

Load more