MATLAB table formatting question?
12 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MATLAB table formatting question? How can I create a table using fprintf without importing data?
Such as inputting (for a 2 column table) the headings on one line, and then I want to input a variable stored as an equation dependent on a value... h (altitude) in one column, and T (temperature dependent on h in an equation) in the other.
All I can get MATLAB to do is display the two headers and only one value of h and one value of T.
SPECIFICALLY, my problem reads: Early explorers often estimated altitude by measuring the temperature of boiling water. Use the following two equations to make a table that modern-day hikers could use for the same purpose. p = 29.921(1 – 6.8753 × 10–6*h) Tb = 49.161*ln(p) + 44.932 where p is atmospheric pressure in inches of mercury, is boiling temperature in F, and h is altitude in feet. The table should have two columns, the first altitude and the second boiling temperature. The altitude should range between –500 ft and 10,000 ft at increments of 500 ft.
I HAVE:
h=[-500:500:10000];p=[(29.921*(1-6.8753*10^(-6)).*h)];T=[(49.161.*log(p)+44.932)];
and
fprintf('Altitude (ft): Boiling Temp. (F):\n)%3.2f %3.2fT','h,T')
this is what I get...
Altitude (ft): Boiling Temp. (F): )104.00 44.00TAltitude (ft): Boiling Temp. (F):
*I want it to look like two headers with long columns beneath them. How can I fix this?
THANKS*
0 Commenti
Risposte (1)
Walter Roberson
il 6 Mar 2013
fprintf('Altitude (ft): Boiling Temp. (F):\n)%3.2f %3.2fT',[h,T].')
0 Commenti
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!