Linprog error - The number of rows in A must be the same as the number of elements of b.

조회 수: 7 (최근 30일)
Hi , I am trying code a linprog optimisation
my code is
Aeq = [PV_power_output(:,:,K) WT_power_output(:,:,M) Bat_power_output]; % supply meets demand every hour
beq = [Hourly_power_demand(j,i)];
A = [PV_emissions_reduction(:,:,K) WT_emissions_reduction(:,:,M) Bat_emissions_reduction];
b = [0.8.*Current_emissions]; % Emissions reduction 20%
x = linprog(f,A,b,Aeq,beq)
I get an error saying "The number of rows in A must be the same as the number of elements of b." Im not sure what detail Im missing since A has one row and b has one element as far I can see!
Thanks

채택된 답변

Alan Weiss
Alan Weiss 2012년 5월 14일
After you enter your code, but before you call the last line
x = linprog(f,A,b,Aeq,beq)
I suggeset that you enter size(A) at the MATLAB command line to see how many rows MATLAB thinks A has.
Alan Weiss
MATLAB mathematical toolbox documentation

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by