필터 지우기
필터 지우기

how to fix error for unrecognized function.

조회 수: 2 (최근 30일)
Juan
Juan 2024년 2월 22일
댓글: Walter Roberson 2024년 2월 22일
function [eqPrice, clearedBuyQuantity, clearedSellQuantity, socialWelfare] = marketClearing(buyPrice,buyQuantity,sellPrice,sellQuantity)
nBuyOrders = length(buyPrice);
nSellOrders = length(sellPrice);
cvx_begin
variable clearedBuyQuantity(nBuyOrders);
variable clearedSellQuantity(nSellOrders);
dual variable eqPrice;
minimize(sellPrice*clearedSellQuantity-buyPrice*clearedBuyQuantity);
subject to
0 <= clearedBuyQuantity <= buyQuantity;
0 <= clearedSellQuantity <= sellQuantity;
eqPrice : sum(clearedSellQuantity) - sum(clearedBuyQuantity) == 0;
cvx_end
socialWelfare = -cvx_optval;
bus1Data = readmatrix(p1Bus1Data.csv);
bus2Data = readmatrix(p1Bus2Data.csv);
  댓글 수: 3
Juan
Juan 2024년 2월 22일
Walter Roberson
Walter Roberson 2024년 2월 22일
You need to have defined values for buyPrice, buyQuantity, sellPrice, and sellQuantity before you call the function.

댓글을 달려면 로그인하십시오.

답변 (1개)

bo zhang
bo zhang 2024년 2월 22일
When you try to run the ‘marketClearing.m’ file directly, your MATLAB workspace does not have the input variables for the function. So the error message shows that the function or variables are unrecogized. You need to find and run the main function file that calls the 'marketClearing' function.
From your code, it is also evident that the MATLAB CVX toolbox is necessary if you want to run this code properly.

카테고리

Help CenterFile Exchange에서 Card games에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by