how to create this matrix?

D
diadalina · Mar 17, 2023 · 2K views
Question
can anyone help me to construct this matrix     blj=(-2)^j-l if lj  
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 12, 2026

I think it would look something like this...

 

iLength = 5; %rows
jLength = 7; %cols

b=zeros(iLength, jLength);

for i = 1:iLength
    for j = 1:jLength
        if i == j; b(i,j) = 1; end
        if i < j; b(i,j) = (-2)^(j-i); end
    end
end

disp(b)
            

gives a result of:

     1    -2     4    -8    16   -32    64
     0     1    -2     4    -8    16   -32
     0     0     1    -2     4    -8    16
     0     0     0     1    -2     4    -8
     0     0     0     0     1    -2     4

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!