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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:19:31+00:00 2026-06-18T04:19:31+00:00

This is probably very simple but I’m having trouble setting up matrices to solve

  • 0

This is probably very simple but I’m having trouble setting up matrices to solve two linear equations using symbolic objects.

The equations are on the form:

(1) a11*x1 + a12*x2 + b1 = 0
(2) a21*x1 + a22*x2 + b2 = 0

So I have a vector {E}:

      [ a11*x1 + a12*x2 + b1 ]
{E} = [ a21*x1 + a22*x2 + b2 ]

I want to get a matrix [A] and a vector {B} so I can solve the equations, i.e.
[A]*{X} + {B} = 0 => {X} = -[A]{B}.

Where

      [ x1 ]
{X} = [ x2 ]

      [ a11 a12 ]
[A] = [ a21 a22 ]

      [ b1 ]
{B} = [ b2 ]

Matrix [A] is just the Jacobian matrix of {E} but what operation do I have to perform on {E} to get {B}, i.e. the terms that don’t include an x?

This is what I have done:

x = sym('x', [2 1]);
a = sym('a', [2 2]);
b = sym('b', [2 1]);

E = a*x + b;
A = jacobian(E,x);

n = length(E);
B = -E;
for i = 1:n
    for j = 1:n
        B(i) = subs(B(i), x(j), 0);
    end
end

X = A\B

I’m thinking there must be some function that does this in one line.

So basically my question is: what can I do instead of those for loops?

(I realize this is something very simple and easily found by searching. The problem is I don’t know what this is called so I don’t know what to look for.)

  • 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-18T04:19:32+00:00Added an answer on June 18, 2026 at 4:19 am

    It is just B = subs(B,x,[0 0])

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this one is probably very simple, but I'm having a bit of trouble
This probably has a very simple answer, but I'm having trouble figuring it out...
This is probably very simple but I've just started using git. I've installed it
Really having an issue debugging this...the reason why is probably very simple but I'm
This problem is probably very simple to solve but it is not clear to
this is probably very simple using javascript or jquery, but I cannot wrap my
This is probably very simple but it's really confusing me. When I implement the
This is probably a very simple question but I'm a little confused how this
I know this is probably a very simple question but how would I do
This is another probably very simple question, but I haven't been able to find

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.