Beantwortet
Index exceeds the number of array elements. Index must not exceed 2.
F1 and F2 are scalar values if you define them as you do in your code. Thus F1(x(n)), F2(x(n-1)) makes no sense. Further x(n) a...

fast 4 Jahre vor | 0

Beantwortet
How do I move the center of my cyclinder to a specific point?
r = 5e-7; [X,Y,Z] = cylinder(r); h = 20e-7; Z = Z*h - 2*r; cyl = surf(X,Y,Z,'FaceColor','none'); rotate(cyl, [0 1 0], 90)

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to optimize a function below a given value?
Use OutputFcn to stop the optimizer manually: https://de.mathworks.com/help/matlab/math/output-functions.html

fast 4 Jahre vor | 0

Beantwortet
Index exceeds the number of array elements (24)
clear all clc T=24;%hour P_pv1(1,1:T) = 270; P_pv2(1,1:T) = 140; P_pv3(1,1:T) = 120; P_pv4(1,1:T) = 150; E1(1,1:T) = 7; ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to generate a random set of x,y coordinates
xmax = 0.4; xmin = 0.2; zmin = 0.2; zmax = 0.32; xrand = rand(1,400); xinit = xmin + xrand*(xmax - xmin); zrand = rand(1,4...

fast 4 Jahre vor | 0

Beantwortet
use fmincon with 0<x1<x2<x3
Strict inequality is not possible. If you are satified with <= instead of <, use -x1 <= 0 x1 - x2 <= 0 x2 - x3 <= 0 o...

fast 4 Jahre vor | 4

| akzeptiert

Beantwortet
How can I write an objective function with its constrain for optimization?
Put your unknowns in a vector x. Write your function to be maximized as f*x where f is to be determined from your above problem...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Index exceeds the number of array elements. Index must not exceed 1.
You use Em(k) and Em * (k) in this line of code. Both cannot be correct, I guess. Further check out whether E(k) is correct: E ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How can i use different solvers like ga, patternsearch, particle swarm etc in problem based Mixed integer Linear Programming
MATLAB chooses the solver that is most appropriate (usually means: fastest) for your problem. Why solving a linear optimization...

fast 4 Jahre vor | 0

Beantwortet
Non trivial solution to a linear system
However whenever I use the A\B command to solve the system I get the trivial solution x=[0 0 0 0 0]' and I am told that this sol...

fast 4 Jahre vor | 0

Beantwortet
How do I mulltiply a complex conjugate vector by its second derrivative (also complex) to get a real number?
I don't know why psi*psi'' should be real, but here is a method to avoid shortening "psi". psi = [0.0100 + 0.0172i 0.0106 + 0...

fast 4 Jahre vor | 0

Beantwortet
How do I get these two equations to work in scenarious like this
As far as I know, MATLAB won't perform algebraic manipulations before substituting variables or algebraic expressions. As an ex...

fast 4 Jahre vor | 0

Beantwortet
Need help debugging code
Your input matrix is missing in the call.

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Index exceeds the number of array elements (24)
Delete the line for t=t+1 and the corresponding end And why do you set P_pv1 = 270; P_pv2 = 140; P_pv3 = 120; P_pv4 ...

fast 4 Jahre vor | 0

Beantwortet
combining varying uneven matrices
m = min(size(A,1),size(B,1)); A = A(1:m,:); B = B(1:m,:);

fast 4 Jahre vor | 0

Beantwortet
Unable to assign a vpasolve result from a for loop
For D = 0, there is no solution for k. And why do you solve for H0_t3 ? If Hb does not depend on H0_t3, the equation for H0_t3 i...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
possible to reduce the relative difference for CheckGradients in optimization (fmincon)?
Why not just turning off the CheckGradient feature if you are sure your derivatives are correct within a certain error tolerance...

fast 4 Jahre vor | 0

Beantwortet
How to color the space between ellipse?
v = -6:0.001:6; % plotting range from -5 to 5 [x y] = meshgrid(v); % get 2-D mesh for x and y cond1 = x.^2 + y.^2/4 >= 1; %...

fast 4 Jahre vor | 0

Beantwortet
How to plot each term of a sum?
The curves seem to be almost identical. y_p = [0.478 3.218 6.322 9.451 12.586 15.724 18.863 22.002 25.143 28.283 31.424 34.565 ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How do I apply an operation to certain elements in a row vector (that are less/more than a given value)
for k=1:A for i = 1:numel(x) if (0 <= x(i)) && (x(i) <= Va(k)) Q = Vb(k)*(1-(Va(k)/L))*x(i); el...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Matlab Matrix calculation coming wrong
% Strain calculation gauge1 = [700;300;500;500]; gauge2 = [700;300;300;700]; gauge3 = [300;700;700;300]; fig = figure; su...

fast 4 Jahre vor | 0

Beantwortet
How to find minimum value and its corresponding variables for a large dataset?
@Kishore Write a function that returns Kpe1 given delta1, theta1, kh, kv and alpha1. Then you can vary the independent variable...

fast 4 Jahre vor | 0

Beantwortet
'sym' returns val = k11
As you can see, there are 36 equations for 12 variables. A solution only exists that approximately satisfies the equations. sym...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Matrix distribution into two vectors that build similiar matrix as a vector product
But you already got the answer for the two vectors a and b and the resulting approximating matrix C: [u s v] = svd(M); n = 1; ...

fast 4 Jahre vor | 0

Beantwortet
Piecewise Function Surface Plot
Hint: The function can be defined as fun = @(x,y) (2*x+2*y^2)*(x+y^2>=0 && x+y^2<=1) + (x+y^2+2)*(x+y^2>1 && x+y^2<=2);

fast 4 Jahre vor | 0

Beantwortet
why do I receive ode15s error?
clc clear close all %Data k = 247; % W/mK rho = 2710; % kg/m^3 Cp = 900; % J/kg...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
how can I plot graph of differential equations with matrix?
No mistake. MATLAB is simply not able to find an analytical solution. Instead of "dsolve", use a numerical ODE integrator, in th...

fast 4 Jahre vor | 0

Beantwortet
How to find minimum value and its corresponding variables?
Add the following two lines at the end of your code: [~,idx] = min(Results(:,5)) all_values = Results(idx,:)

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How do I get the second solution?
Pr = 1; %fixed lambda =-1.1; %mixed convection parameter (lambda) a = 0; b = 10; % b = infinity solinit = bvpinit(linspa...

fast 4 Jahre vor | 0

Beantwortet
loop on matrix array
The following code computes the distance between the columns of M. M = [0 3 -1 4 6 13 -2 0 4]; D = squareform(pdi...

fast 4 Jahre vor | 0

Mehr laden