I having a problem with my code in MATLAB. In the following code results for r is just a 1x3 matrix. Although inside the while loop r equals to multiple 1x3 matrices. I need r equal to one matrix that is of size 27032x3. So, I just need the multiple r matrices to merge together to get one big matrix. I need that matrix to retain its value outside the while loop as well. cc=0; % set line counter JD = 2460626.666667; fid = fopen('tle_catalog.txt'); % load the TLE tline2='gg'; while ischar(tline2) cc = cc+1; % counter name = fgets(fid);% for the ones with three lines tline1 = fgets(fid); % collect first line of two line elements tline2 = fgets(fid); % collect second line of two line elements if tline2>0 % stop at the end of the file % initialize the propagation [satrec, startmfe, stopmfe, deltamin] ... = twoline2rv(721, tline1, tline2, 'c', 'd'); time_JD = tline1(21:32); yeardayhour = str2double(regexp(tline1, '(\d{2})(\d{3})(\.\d+)', 'tokens', 'once')); dn = datenum(yeardayhour(1) + 2000, 0, yeardayhour(2), 24 * yeardayhour(3), 0, 0); dt = datetime(dn, 'ConvertFrom', 'datenum'); JD_tle = juliandate(dt); % how far shall the TLE be propagated [minutes] tsince = JD - JD_tle; % extract position and velocity [satrec, r, v] = sgp4(satrec, tsince); end end r
I having a problem with my code in MATLAB. In the following code results for r is just a 1x3 matrix. Although inside the while loop r equals to multiple 1x3 matrices. I need r equal to one matrix that is of size 27032x3. So, I just need the multiple r matrices to merge together to get one big matrix. I need that matrix to retain its value outside the while loop as well. cc=0; % set line counter JD = 2460626.666667; fid = fopen('tle_catalog.txt'); % load the TLE tline2='gg'; while ischar(tline2) cc = cc+1; % counter name = fgets(fid);% for the ones with three lines tline1 = fgets(fid); % collect first line of two line elements tline2 = fgets(fid); % collect second line of two line elements if tline2>0 % stop at the end of the file % initialize the propagation [satrec, startmfe, stopmfe, deltamin] ... = twoline2rv(721, tline1, tline2, 'c', 'd'); time_JD = tline1(21:32); yeardayhour = str2double(regexp(tline1, '(\d{2})(\d{3})(\.\d+)', 'tokens', 'once')); dn = datenum(yeardayhour(1) + 2000, 0, yeardayhour(2), 24 * yeardayhour(3), 0, 0); dt = datetime(dn, 'ConvertFrom', 'datenum'); JD_tle = juliandate(dt); % how far shall the TLE be propagated [minutes] tsince = JD - JD_tle; % extract position and velocity [satrec, r, v] = sgp4(satrec, tsince); end end r
Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
Related questions
Question
I having a problem with my code in MATLAB. In the following code results for r is just a 1x3 matrix. Although inside the while loop r equals to multiple 1x3 matrices. I need r equal to one matrix that is of size 27032x3. So, I just need the multiple r matrices to merge together to get one big matrix. I need that matrix to retain its value outside the while loop as well.
cc=0; % set line counter
JD = 2460626.666667;
fid = fopen('tle_catalog.txt'); % load the TLE
tline2='gg';
while ischar(tline2)
cc = cc+1; % counter
name = fgets(fid);% for the ones with three lines
tline1 = fgets(fid); % collect first line of two line elements
tline2 = fgets(fid); % collect second line of two line elements
if tline2>0 % stop at the end of the file
% initialize the propagation
[satrec, startmfe, stopmfe, deltamin] ...
= twoline2rv(721, tline1, tline2, 'c', 'd');
time_JD = tline1(21:32);
yeardayhour = str2double(regexp(tline1, '(\d{2})(\d{3})(\.\d+)', 'tokens', 'once'));
dn = datenum(yeardayhour(1) + 2000, 0, yeardayhour(2), 24 * yeardayhour(3), 0, 0);
dt = datetime(dn, 'ConvertFrom', 'datenum');
JD_tle = juliandate(dt);
% how far shall the TLE be propagated [minutes]
tsince = JD - JD_tle;
% extract position and velocity
[satrec, r, v] = sgp4(satrec, tsince);
end
end
r
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education

Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press

Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON

Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education

Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY

Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning

Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY