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 8533581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:59:40+00:00 2026-06-11T09:59:40+00:00

I have some difficulties in converting a pseudocode into a MatLab algorithm. Specifically, there

  • 0

I have some difficulties in converting a pseudocode into a MatLab algorithm. Specifically, there is one part I don’t quite know how to do. I will write the pseudocode up to the point where I am uncertain:

 input n, (a_{ij}), (b_i), (x_i), M
    for k = 1 to M do
       for i = 1 to n do

           u_i = (b_i - sum[(from j = 1, (j ≠ i), to n) a_{ij} * x_j]) / a_{ii}
       end do

The difficulty I have is when I have to write the sum-part. What I can’t figure out is how to write the algorithm so that terms where j ≠ i are not included. So far I have written:

function [k,x] = jacobimethod(A,b,M)
n = length(A);
u = zeros(1,n);
x = zeros(1,n);
for k = 1:M
    for i = 1:n
        u(i) = (b(i) - (A(i

And this is where I get stuck. So far, all my algorithms have involved sums where all terms should be included, even those where j = i. In this case, the sum term will simply be:

A(i,1:n)*x(1:n)'

But how can I modify this so that A(i,i) is not included?

Any help will be greatly appreciated!

  • 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-11T09:59:41+00:00Added an answer on June 11, 2026 at 9:59 am

    You could make an explicit index array and remove the index you don’t need

    % inside of the loop
    idx = 1:n;
    idx(i) = [];
    u(i) = (b(i)-sum(A(i,idx).*x(idx)))/A(i,i);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some difficulties to understand which thread execute particular method. Are there any
I'm trying to create a Textmate snippet, but have run into some difficulties. Basically,
So I seem to have some difficulties with making my CodeFile reference into CodeBehind.
I have some difficulties with understanding BindingSource's behaviour. Let's look at following example: Creating
I have some difficulties in my project. I got the RGB values from a
I have some difficulties for using Ruby block, passing in a method. As in
I'm have some difficulties here, I am unable to successfully call a method which
I am new to programing and I have some difficulties getting AlertDialog working. I
I'm having some difficulties with Ajax.BeginForm I have something like this in a view
i have some difficulties changing tab bar controllers. Basically I have UITabBarController with 3

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.