Beantwortet
How do I generate numbers from an Exponential Distribution within Min and Max values?
pd = makedist('Exponential','mu', 1.5); n = 100; lb = 0.5; ub = 4.3; rv = zeros(n,1); i = 0; while i < n r = random(p...

etwa 3 Jahre vor | 0

Beantwortet
Index in position 2 exceeds array bounds
I already showed you how to solve "ode" as well as "ode1" simultaneously for D2p and D2q. This is necessary because both depend ...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Error due to integration
%filename ='Torque.xlsx'; %sheet = 'Averages'; %A = readtable(filename,'Sheet',sheet,'Range','A3:L32'); %A = table2array(A); ...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do I fix "Index in position 2 exceeds array bounds (must not exceed 1)."
Before entering the loop after which the error message pops up, type size(gamma) size(sigma_g) size(g_omega_q_k_q) and chec...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
optimization for nonlinear equation using fminunc
x0 = [1 1 1]; fun = @(x) x(1)*dsdt + x(2)*s.^x(3); f = @(x) sum(sum((fun(x) - p).^2)); x = fminsearch(f,x0) lhs = fun(x)

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Trouble formulating Range Kutta
The expression [-ka3*A\[0; 1 ;0] zeros(3,1)] must be 6x6 instead of 3x2 in order to work for your system. And the numerical i...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Unable to perform assignment because the size of the left side is 10-by-1 and the size of the right side is 10-by-1-by-10.
In the assignments RHS(:,pp,gg) = (((1-alpha1(pp)... and RHS(:,pp,gg) = (((1-alpha2(pp)... the resulting term on the righ...

etwa 3 Jahre vor | 1

Beantwortet
Generate function handle for odesolver dynamically
Define your equations by a function instead of a function handle. In the function, you can make a loop in order to account for t...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Retrieve value from cell(array)
solution = fsolve(F,arrayfun(@(i)vertcat(X_sol{1,i}(1,1)),1:size(X_sol,2))) But you should avoid making your code too general b...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to compute 8 days mean from one year data?
data_matrix = readtable('sample.csv'); data_matrix = table2array(data_matrix); n = floor(365/8); out_day = zeros(n+1,9); for...

etwa 3 Jahre vor | 0

Beantwortet
Runge-Kutta Integration 4th Order - Taylor Maccoll
% Isentropic exponent gamma = 1.4; % assumed shock anngle Theta_shock = 14.35; % Mach number M = 6; % Compute initial cond...

etwa 3 Jahre vor | 0

Beantwortet
I have a code, but it keeps saying "Supplied objective function must return a scalar value.'
I have a code, but it keeps saying "Supplied objective function must return a scalar value.' Yes, that's true. Your function "S...

etwa 3 Jahre vor | 0

Beantwortet
Unspecified number of dimension for ndgrid
https://uk.mathworks.com/matlabcentral/answers/372299-how-to-do-a-cycle-through-a-n-dimensional-grid-if-n-is-not-fixed

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Not enough input arguments
You must return dCdt and dSdt at time t in function "SBR1": function dy = SBR1(t,y) C = y(1); S = y(2); ... % Calcu...

etwa 3 Jahre vor | 0

Beantwortet
Runge-Kutta 4th order Integration - Taylor-Maccoll
gamma = 1.4; % intitial values uR(y1) and uTheta(y2), behind the shock wave g0(1) = 0.9078; g0(2) = -0.1262; % assumed shock...

etwa 3 Jahre vor | 0

Beantwortet
I use the PSO optimization algorithm and I get the error Unable to perform assignment because the size of the left side is 10-by-1 and the size of the right side is 1-by-3.
The reason for the error message is obvious. You can't save a 1x3 array (actfunc(randperm(3))) in a 10x1 array (particles(:, 2))...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Creating a square multidimensional array from a function
x= -7:0.1:7; y= -7:0.1:7; z= -7:0.1:7; [X,Y,Z] = ndgrid(x,y,z); F = fun(X,Y,Z) size(F) function f = fun(x,y,z) f = ...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to resolve this error "Array indices must be positive integers or logical values."
You forgot a multiplikation sign: t2=((f*vmax+xf*Dq*(-mum+3*m+12*(s^2))+4.5*(s^2)*(xf^2)*D2q)/(r-(3*m+3*(s^2)))); instead of ...

etwa 3 Jahre vor | 0

Beantwortet
fitting data with a combination of exponential and linear form ( a*exp(-x/b)+c*x+d )
Try f(x) = a*atan(b*x) It's too steep at the beginning and too flat at the end, but better than your model function. data= r...

etwa 3 Jahre vor | 1

Beantwortet
Linear Regression with Only Dependent Variables
The model with parameters a, b and c to be determined should be column_matrix_1 * a/sqrt(a^2+b^2) + column_matrix_2 * b/sqrt(a^...

etwa 3 Jahre vor | 0

Beantwortet
Making a new column from old column
x = linspace(0.1,1,17).'; y = x; y(y>0.5) = 1;

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Boundary value problem-bvp4c
Use ode45 and integrate backwards: https://uk.mathworks.com/matlabcentral/answers/1881197-numerical-integration-backwards-for-o...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do i add a changing input over a interval using ODE45?
v = 25/3.6; % Speed of the car Lslope = (0.5/v)*1000; % Length of the slope in time (assuming v is ...

etwa 3 Jahre vor | 0

Beantwortet
I am getting error "Index in position 2 exceeds array bounds (must not exceed 6)"
You should try [u,s,v]=svd(xi); instead of [u,s,v]=svd(xi,0);

etwa 3 Jahre vor | 0

Beantwortet
3D Heat Equation in PDE Solver
T_center = interpolateTemperature(results, 5,5,0.5); You didn't specify the times at which you want the temperature to be suppl...

etwa 3 Jahre vor | 0

Beantwortet
Visualizing 2D Slices of a 3D Shape Subject to 3D Heat Equation and Boundary Conditions
I have no experience with the PDE toolbox, but it seems from the error message that you defined a stationary, not a time-depende...

etwa 3 Jahre vor | 0

Beantwortet
Trying to find a solution for nonlinear ODE
The variables are ordered as [y(1) y(2) y(3) y(4)] = [p dp/dx q dq/dx]. You will have to add the boundary condition part. syms...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
problem in for loop not working in fixed point iteration while loop
Maybe like this ? clear all load('results.mat') N_pr = 99; P_sat = Pb; P_abandon = 1700; delh_pr = (P_sat-P_abandon)/N_pr;...

etwa 3 Jahre vor | 0

| akzeptiert

Beantwortet
Plotting the 3D Heat Equation in 2D Slices
Your implementation of Explicit Euler looks correct. If you want larger time steps and faster performance, use an ODE solver li...

etwa 3 Jahre vor | 1

Beantwortet
How to get the available solution of the singular matrix equations?
The system cannot be solved with equality because rank(A) = 68 while rank([A,b]) = 69. You can only try to find a vector x that...

etwa 3 Jahre vor | 0

Mehr laden