Respondida
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)

casi 4 años hace | 1

| aceptada

Respondida
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

casi 4 años hace | 0

Respondida
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; ...

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 4

| aceptada

Respondida
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...

casi 4 años hace | 1

| aceptada

Respondida
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 ...

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

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

casi 4 años hace | 0

| aceptada

Respondida
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 ...

casi 4 años hace | 0

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

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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; %...

casi 4 años hace | 0

Respondida
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 ...

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

Respondida
'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...

casi 4 años hace | 0

| aceptada

Respondida
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; ...

casi 4 años hace | 0

Respondida
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);

casi 4 años hace | 0

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

casi 4 años hace | 1

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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,:)

casi 4 años hace | 0

| aceptada

Respondida
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...

casi 4 años hace | 0

Respondida
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...

casi 4 años hace | 0

Respondida
fitlm - only positive coefficients
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.

casi 4 años hace | 0

Cargar más