how can I create a matrix from calculated answers

T
tanveer · Aug 18, 2020 · 2.2K views
Question
I have this answers and I want to put them in a diagonal matrix.Pls help me! y = 0.0025 + 0.0155i y = 0.0030 + 0.0171i y = 0.0038 + 0.0191i y = 0.0049 + 0.0216i y = 0.0066 + 0.0248i y = 0.0092 + 0.0289i y = 0.0137 + 0.0344i y = 0.0220 + 0.0414i y = 0.0388 + 0.0487i y = 0.0717 + 0.0450i y = 1000000 y = 0.0717 - 0.0450i y = 0.0388 - 0.0487i y = 0.0220 - 0.0414i y = 0.0137 - 0.0344i y = 0.0092 - 0.0289i y = 0.0066 - 0.0248i y = 0.0049 - 0.0216i y = 0.0038 - 0.0191i y = 0.0030 - 0.0171i y = 0.0025 - 0.0155i
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 12, 2026
Don't you think it would help if you showed us how that "this answers" was generated? It really would.
.
.
.
.
.
.
EDIT
O.k., here is one way, with your FOR loop:
 
clear all
f=1E3;
L1=1E-3;
L2=100;
Rs=1E-6;
R1=10;
w=2*pi*f;
k=10;
z1=eye(21);  % I assume you want this to be the matrix.
cnt = 1;
for a = -11:k-1
    omega = w*(a+1);
    z1(cnt,cnt)=1/(Rs+(j*omega*L2*((R1+j*omega*L1)))/(R1+j*omega*(L1+L2)));
    cnt = cnt + 1;
end

or

f=1E3;
L1=1E-3;
L2=100;
Rs=1E-6;
R1=10;
w=2*pi*f;
k=10;
omega = w*((-11:k-1)+1);
z1_2 = diag(1./(Rs+(j*omega*L2.*((R1+j*omega*L1)))./(R1+j*omega*(L1+L2))));
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!