Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:52:19+00:00 2026-06-07T17:52:19+00:00

Hi I am working with the brute force method to examine possible combinations of

  • 0

Hi I am working with the brute force method to examine possible combinations of “panels” and “turbines”

My code is

 for number_panels = 0:5

for number_turbines = 0:10


    for n = 1:24 % number of hours per day



deficit(n) = Demand(n) - (PV_supply(n)*number_panels) -...
 (WT_supply(n)*number_turbines);% hourly power deficit

        if deficit(n)<0

            deficit(n) = 0;

        end

The problem I have above is that I haven’t yet figured the correct indexing of this code.

What I am trying to do is find the “deficit” for the “number_panels” , “number_turbines” and “n”. As it stands I can only find the “deficit” for the last for loop.
How can I code so that I can have the option to access the nth row (or sets of “n” i.e 1-24) and also for the “number_panels” “number_turbines” option?


thanks – in order to find the sum of each deficit(n) value and thus have the respective total deficit of the 24 hour period I have done the following which seems to me to be able to do what I am asking but I am getting incorrect answers:

 daily_deficit(number_panels + 1, number_turbines + 1) =...
 sum(deficit(number_panels + 1, number_turbines + 1,n)) –
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:52:21+00:00Added an answer on June 7, 2026 at 5:52 pm

    function calcDeficit.m:

    File Edit Options Buffers Tools ObjC Help                                                                              
    function deficit = calcDeficit (Demand, PV_supply, WT_supply)
    
      % initialize the size (good practice)
      deficit = zeros(6,11,24);
    
    
      for number_panels = 0:5
    
        for number_turbines = 0:10
    
          for n = 1:24 % number of hours per day
            deficit(number_panels+1,number_turbines+1,:) = Demand(n) - (PV_supply(n)*number_panels) -...
              (WT_supply(n)*number_turbines);% hourly power deficit
    
            if deficit(n)<0 
              deficit(n) = 0;
            end
          end
        end
      end
    return
    

    example call:

    Demand=randn(24,1); PV_supply=randn(24,1); WT_supply=randn(24,1); test(Demand,PV_supply,WT_supply)
    

    You access Demand by

    Demand(panels+1,number_turbines+1,hour)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am working with the following code (Brute force method). PV_supply and WT_supply
hi I am working with the brute force method that I have shown in
Working with an undisclosed API, I found a function that can set the number
I'm working on problem 12 regarding the first triangle number with 500 divisors. I
This evening I noticed a brute force attack attempt from the same IP address
I'm doing some kind of brute force attack to solve a problem. Theoratically it
I am doing a brute force search for gradient extremals on the following example
So I'm trying to make a brute force string generator to match and compare
I'm trying to come up with a non brute-force solution to the following problem.
I've started working on some Project Euler problems, and have solved number 4 with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.