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

  • SEARCH
  • Home
  • 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 8221935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:06:23+00:00 2026-06-07T14:06:23+00:00

hi I am working with the brute force method that I have shown in

  • 0

hi I am working with the brute force method that I have shown in the code below.

the size of PV_supply, WT_supply and Demand are all 48×1.

what I am tying to do is calculate the “hourly_deficit” equation for n = 1:24 and n = 25:48 separately so as to output 2 “sets” of “hourly_deficit”

My code is

for number_panels = 0:5
    for number_turbines = 0:3
      for n = 1:24:48 % number of hours per day

  hourly_deficit(number_panels + 1, number_turbines + 1, n) =...
 Demand(n) - (PV_supply(n)*number_panels) - (WT_supply(n)*number_turbines);

end 
 end 
  end

I was hoping on some help with how I should adapt the for loop so as to get the results as I am looking for. As it stands, the for n = 1:24:48 only actually goes up to n = 24

Thank you

  • 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-07T14:06:25+00:00Added an answer on June 7, 2026 at 2:06 pm

    1:24:48 means “from 1 by increments of 24 until 48”: The values therefore would be 1 25 49... if you kept the series going. Since 49 is outside the bounds you defined, it stops at 25.

    One solution for doing what you want would be the following:

    for n = 1:24 % 1 by 1 to 24
    
        hourly_deficit_1(...,..., n)= Demand(n)-(PV_supply(n)... %# truncated
        n=n+24;
        hourly_deficit_2(...,..., n)= Demand(n)-(PV_supply(n)... %# truncated
    
    end 
    

    To generalize for any number of days, add a 4th dimension to the matrix. Third dimension would be hour (1:24), 4th would be day.

    for h=1:24 %# hours
        for d = 1:num_days %# which day
            n = h + 24*(d-1);
            hourly_deficit_1(...,..., h, d)= Demand(n)-(PV_supply(n)... %# truncated
        end    
    end 
    
    • 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 to examine possible combinations of
I have a medical app for the iPhone that I'm working on, where a
I am working on an Eclipse RCP-based application, and we have decided that we
Something like this. I want to brute force all characters with word of 10
Working with an undisclosed API, I found a function that can set the number
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
I have a backend that generates gift codes, each with a certain number of
This is one of the problem i have been working from a long time.This
I have a byte[] testKey = new byte[8]; This obviously starts with all bytes

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.