How does bitshift work?
dec2bin(56,8) In other words, your difficulty is that 0101 0110 is not the correct representation for 56.

3 días ago | 1

| accepted

Accuracy small numbers converted to symbolic
sym('2e-6') sym(2)*10^(-6)

3 días ago | 1

| accepted

the chaotic map Encryption Using baker Map

3 días ago | 0

How to set up and 'if' function depending on the user inputs
floorNumbers=input('Please enter the number of floors in the building: '); floorSpaces = zeros(1,floorNumbers); x = zeros(fl...

3 días ago | 0

How to plot two point out, which is related to x*log2(x) as x->0
p0 = 0:0.01:1; syms P0 p1 = 1 - P0 ; H = (-1).*P0.*log2(P0) + (-1).*p1.*log2(p1) ; HH = arrayfun(@(P) limit(H,P0,P), p0); p...

3 días ago | 0

equalizing few matrices size in a cell
minlen = min(cellfun(@length, YourCell)); truncCell = cellfun(@(C) C(1:minlen), YourCell, 'uniform', 0)

3 días ago | 0

| accepted

Workspace in Matlab shows value not formula
When you do the Create of the variable, give it a nominal value such as 1. Then find the variable in the model "External Data" s...

4 días ago | 1

| accepted

symsum does not return sum of series when a constant is replaced by symbol
S = -(l^d*(d - 7)*hypergeom([1, d/7], [d/7 + 1, d/7 + 1, d/7 + 1/7, d/7 + 2/7, d/7 + 3/7, d/7 + 4/7, d/7 + 5/7, d/7 + 6/7], l^7/...

4 días ago | 0

I am getting this Error using makeState (line 56). Your fitness function must return a scalar value.
k is a 4 x 1 column vector. X is a 4 x 1 row vector. k.*X(1:N) is then (4 x 1) .* (1 x 4) which gives a 4 x 4 result. Change M...

4 días ago | 0

how to fix this error 'Index exceeds array dimensions. Index value 3 exceeds valid range [1-2] for array 'a'. '
Replace the loop with mask = a > 0; a = a(mask); b = b(mask); if isempty(a) k = 1; else k = max(0, min(a./b)); e...

4 días ago | 0

| accepted

how to do conditional statements using optimisation variables?
Cost = Costa.*(PbattV<=200) +Costb.*(PbattV>=200); Optimization variables cannot be converted to logical values. The only time...

4 días ago | 0

| accepted

Plotting with an array in an equation
Let theta be an N by number_of_angles array (so each row refers to a different time step) m_temp = sum(cos(theta),2); At this ...

4 días ago | 0

Need to solve the code?
X3 = @(z3,U,V) (U+(V*z3)); So X3 is a function handle. X3 = U+(A3*B1*V); So X3 is a numeric variable now. But yo...

4 días ago | 0

| accepted

Can I scale my data independently in ploteditor (or similar) once the plot has been produced, i.e not programatically
No, Mathworks does not supply a tool for that purpose. Some subsets of that behaviour are easy to program, but you specifically ...

4 días ago | 0

| accepted

Retrieve File Installation Key From Network License Manager

4 días ago | 0

Why this code gives error?
plot(f,20*log10(FFT_abs/max(FFT_abs)),'b+-','linewidth',3); Named options must always go after all positional parameters.

5 días ago | 0

How to solve symbolic equation with variable inputs
Is the idea that the user would either enter a numeric value or else the corresponding symbolic variable name? For example, the ...

5 días ago | 0

How can i reshape the code as below
compose("%02x", reshape(sscanf(k,'%2x'),4,[])) This will return a 4 x 8 string array, not a char array. If you want a 4 x 8 arr...

5 días ago | 1

How to convert byte array to image in matlab?
reconstructed_image = reshape(typecast(int8(arrayfun(@byteValue, YourByteArray)),'uint8'), [4000, 3000, 3]); There might well b...

5 días ago | 0

Give title for Table
No, table() is designed for programming, not for display purposes.

5 días ago | 1

Array indices must be positive integers or logical values. Error in WCA (line 44) pop(i).cost=objective_function(pop(i).position); I am getting this issue while I am running the code of distribution load flow analysis
In BackwardFarwardNew_28bus.m you have objective_function = min(P_l); [Xmin,Fmin,NFEs,Elapsed_Time]=WCA(objective_function,LB,...

5 días ago | 0

how can i create sliding window matrix for a single column matrix
nlfilter() https://www.mathworks.com/help/images/ref/nlfilter.html

5 días ago | 1

| accepted

parse error at x: usage might be invalid matlab syntax
f = @(x) 0.2 + 25*x - 200*x^(2) + 674==5*x^(3) - 900*x^(4) + 400*x^(5);

6 días ago | 0

i am getting the following error while i am runnig water cycle algorithm, for optimum location placing DG pleasae please help me how to solve this issue. i am attaching files
objective_function is expected to be a function handle, but you are passing in a numeric value instead.

6 días ago | 1

| accepted

Not enough input arguments
You are trying to execute knifEdge by name or by pressing the green Run button. You need to go to the command line and invoke it...

6 días ago | 0

W = [1 4 3 3 9 7 5 10 5 8 6]; a=[1 2 4 2 1 1 1 3 3 4 2]; b=[2 4 6 5 5 4 3 6 4 5 3]; mx = max(max(a),max(b)); DG = sparse(a...

7 días ago | 0

| accepted

Turn logical matrix into string vector
idx = logical([0 1 0; 0 0 1; 1 0 0; 1 0 0; 0 1 0]) vec = ["A","B","C"] vec(idx(:,1)*1 + idx(:,2)*2 + idx(:,3) * 3).' vec(id...

7 días ago | 0

Reference to nonexistent field 'xdot1'.
In your OpenFcn initialize the edit field String properties, and initialize the handles.* values appropriately. Alternatively...

7 días ago | 0