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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:47:27+00:00 2026-06-11T14:47:27+00:00

I have a 3×3 matrix, A. I also compute a value, g , as

  • 0

I have a 3×3 matrix, A. I also compute a value, g, as the maximum eigen value of A. I am trying to change the element A(3,3) = 0 for all values from zero to one in 0.10 increments and then update g for each of the values. I’d like all of the other matrix elements to remain the same.

I thought a for loop would be the way to do this, but I do not know how to update only one element in a matrix without storing this update as one increasingly larger matrix. If I call the element at A(3,3) = p (thereby creating a new matrix Atry) I am able (below) to get all of the values from 0 to 1 that I desired. I do not know how to update Atry to get all of the values of g that I desire. The state of the code now will give me the same value of g for all iterations, as expected, as I do not know how to to update Atry with the different values of p to then compute the values for g.

Any suggestions on how to do this or suggestions for jargon or phrases for me to web search would be appreciated.

A = [1 1 1; 2 2 2; 3 3 0];  
g = max(eig(A));

% This below is what I attempted to achieve my solution
clear all  
p(1) = 0;
Atry = [1 1 1; 2 2 2; 3 3 p];  
g(1) = max(eig(Atry));  

for i=1:100;  
    p(i+1) = p(i)+ 0.01;
    % this makes a one giant matrix, not many  
    %Atry(:,i+1) = Atry(:,i); 
    g(i+1) = max(eig(Atry));  
end  
  • 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-11T14:47:28+00:00Added an answer on June 11, 2026 at 2:47 pm

    This will also accomplish what you want to do:

    A = @(x) [1 1 1; 2 2 2; 3 3 x];
    p = 0:0.01:1;
    g = arrayfun(@(x) eigs(A(x),1), p);
    

    Breakdown:

    • Define A as an anonymous function. This means that the command A(x) will return your matrix A with the (3,3) element equal to x.
    • Define all steps you want to take in vector p
    • Then “loop” through all elements in p by using arrayfun instead of an actual loop.

    The function looped over by arrayfun is not max(eig(A)) but eigs(A,1), i.e., the 1 largest eigenvalue. The result will be the same, but the algorithm used by eigs is more suited for your type of problem — instead of computing all eigenvalues and then only using the maximum one, you only compute the maximum one. Needless to say, this is much faster.

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

Sidebar

Related Questions

I have a table about inverse gamma correction these are the values coresponding from
Have dict like: mydict= {'a':[],'b':[],'c':[],'d':[]} list like: log = [['a',917],['b', 312],['c',303],['d',212],['a',215],['b',212].['c',213],['d',202]] How do i
Have a painfully simple blog Post creator, and I'm trying to check if the
I have a MySQL table named relations, as follows: from to count ------------- A
I have a MySQL table named relations, as follows: from to count ------------- A
I have a 63row x 7column matrix. xmax=63; ymax=7; for i=1:xmax for j=1:ymax n=(i-1)*ymax+j;
I have a Box container that has a label element inside it. When the
I have written a small example C++ program, using boost::thread. Since it's 215 lines,
I have this string: 525,294,475,215,365,745 and i need to remove 475..and comma. and if
I have a problem with CSS values larger than 2¹⁵ in Opera, such as

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.