Answered
In this code, I want to find out slope at every value of x?
The answer doesn't change because of new x/y data: clear all clc x=[10.33 10.331 10.332 10.333 10.334 10.335 10.336 10.337 10...

3 years ago | 0

Answered
How to get complete curves in a plot?
clc clear %discretize the space based on uniform spacing(eta) eta = 0.02; N = 300; %specific the slope of second derivative...

3 years ago | 0

| accepted

Answered
How can I run these codes in a for loop?
for i = 0:4 idx(i+1) = hour(result.HourSeries1)==strcat('0',string(i)); m(i+1) = mean(Climatology1.H1(idx(i+1),:)); e...

3 years ago | 0

Answered
solve constraint optimization problem
x = optimvar('x'); prob = optimproblem; M=[1 x;x 1+2*x]; prob.Objective = norm(M,'fro')^2; prob.Constraints.cons1 = x^2-2*x ...

3 years ago | 1

| accepted

Answered
How to put value from one matrix into another matrix
A = [3:42;rand(1,40)].'; B = [6 45 18 24 33;5 12 17 23 32;4 11 16 22 31;3 10 15 21 30]; result = zeros(size(B)); for i = 1:...

3 years ago | 0

Answered
add conditional constrain in optimization
Define x_it be the decision variable if pump i is active at time t. That means x_it can take values 0 and 1 and equals 0 of pump...

3 years ago | 0

| accepted

Answered
Finding all the positive Roots of non linear equation and plotting the modes
f = @(k) cos(k).*cosh(k)+1; K = 0:0.1:8; plot(K,f(K)) k(1) = fzero(f,[1 4]) k(2) = fzero(f,[4 5]) k(3) = fzero(f,[5 9]) Th...

3 years ago | 0

| accepted

Answered
solve equation for a variable
You don't need a toolbox for this. Take a piece of paper and a pencil, multiply the equation by the denominator of the left-han...

3 years ago | 0

Answered
How to put value from one matrix into another matrix
help reshape Or are the entries of the matrix B not necessarily as regular as in your picture ? A = [1 2 3 4 5 6 7 8;0.2 0.8 0...

3 years ago | 0

Answered
At every value of x, how measure slope of plot?
Look at the approximate slope curve under https://de.mathworks.com/matlabcentral/answers/1919960-how-can-i-interpolate-x-and-y-...

3 years ago | 0

Answered
How can I interpolate x and y data points in plot and slope (dy/dx) at any value of x?
x=[15 20 25 30 35 40 45 50 55]; y=[11.89 11.845 11.85 11.855 11.865 11.93 12.01 12.2 12.77]; % Approximate dy/dx dy = gradien...

3 years ago | 0

| accepted

Answered
Modeling using 6 differential equation and a constraint?
v = FT*0.082*T/P = sum(dydVol)*0.082*T/P = 1/v*sum(dydVol*v)*0.082*T/P -> v^2 = sum(dydVol*v)*0.082*T/P Thus define the d...

3 years ago | 0

Answered
Index must not exceed 10, but why???
If dt is an array of length 10, then "n" in the loop "for j = 1:n" must be <= 10 since you try to access dt(j). Is this the ca...

3 years ago | 1

| accepted

Answered
How to save a vector from each iteration in a loop in a matrix?
output_all(:,i) = output(1,:).'; instead of output_all(:,i) = output(1,:);

3 years ago | 0

Answered
No solution found. fsolve stopped because the relative size of the current step is less than the value of the step size tolerance squared
q=1.6e-19; kb=1.38e-23; T=300; phit=(kb*T)/q; % Ilgt=20e-3; % Irevsat=1.98e-15; rshunt=1e3; rseries=10; n=1; V_array=-1...

3 years ago | 3

| accepted

Answered
Minimize a function with equality, inequality, and product in constraints
x2,x3,x5 and x7 are all >= 0. Thus the constraint (x5+x2)*(x3+x7) = 0 either gives x5=x2=0 or x3=x7=0. Thus use "linprog" twi...

3 years ago | 1

Answered
how to iterate cell array?
all_N1 = cell(51,1); % Generate 100 matrices of size 20x20 and save them in cell array for i = 1:100 all_N1{i} = rand(20); ...

3 years ago | 0

Answered
Solving an eq. using a large table by vpasolve is to slow
syms A.var1 A.var2 A.var3 A.var4 X Equation = ((A.var1 -c1*X^4)- (c2*A.var2*(6.105.*exp((c3*X)./(X+c4)) -A.var3)) - (c5*(X-A.v...

3 years ago | 0

| accepted

Answered
Solving matrix differential equation
I took R10, R20 as initial conditions for your matrix equations. I formed W1, W2 with the matrices R1 and R2 at time t. You for...

3 years ago | 0

| accepted

Answered
subs() in symbolic chain rule outpus incorrect derivative?
The below looks fine to me. Which MATLAB version do you use ? syms x y(x) f(a,b) Df = diff(f(x,y(x)),x) Df = subs(Df,diff(y(x...

3 years ago | 0

| accepted

Answered
Approximating parameters with ODE, error using vertcat dimesions of arrays being concatenated are not consistent
If you debug your code, you will see that c has dimension 1x12 while theta has dimension 1x11 in the function "fhat". Thus the...

3 years ago | 0

Answered
why do i get an error saying not enough input arguments for this code using bvp4c? it also says there is an error in dYdx(1)=Y(2)
solinit=bvpinit(x,[0;0;0;0;1;0;1;0]); instead of solinit=[0;0;0;0;1;0;1;0]; and sol=bvp4c(@bvp_func,@boundary_conditions,sol...

3 years ago | 1

Answered
Problems using Linear Regression and syntax
For the Antoine equation, you usually work with log10: T = [273.15; 300.00; 310.00; 320.00; 330.00; 340.00; 350.00; ...

3 years ago | 0

Answered
Please, help to find a mistake in the code for double integral
n = 1 ; t = 1; k = 1; %(k is ksi in formula) s = 0:0.5:20; fun = @(x,q,p) ((x.*exp(2*n*t.*(x.^2)))./sqrt(1-x.^2)).*(exp(-2*t...

3 years ago | 0

Answered
MATLAB giving me a 16x1 complex double answer?
Replace syms w h by syms w h real positive

3 years ago | 0

Answered
How do I plot 5e^(0.5t)sin(2*pi*t)
Note that sin(2*pi*t) = 0 for t = 0,1,2,3,...,10. And these are the only points for t you specified.

3 years ago | 1

Answered
How to write as symbolic piecewise function with conditions on a symbolic vector
n = 2; Xi = sym('Xi',[1 n]); ff = piecewise(max(abs(Xi))<=1,sum(Xi.^2),Inf) fsurf(ff)

3 years ago | 1

Answered
Solving matrix differential equation
From the documentation of ode45: y0 — Initial conditions vector Initial conditions, specified as a vector. y0 must be the sam...

3 years ago | 0

Answered
Trapezoidal numerical integration of f(y) = ( 1 / x(y) ) dy
y_p = 1.6; % position where the force is applied y = [0, 0.2, 0.3, 0.5, 0.7, 0.9, 1, 1.2, 1.4, 1.6]; % y coordinates x = [3.5,...

3 years ago | 0

Answered
Fast Element-Wise power to non-integer value
I don't know your optimization problem, but this helps saving function evaluations if objective function and constraints share t...

3 years ago | 0

| accepted

Load more