The programming style strongly suggests this is a mapping of C code into M-code, although there is some vectorisation. My main reason for the 1-star rating is that it lacks help and comments in the code.
02 Nov 2008
vecInsert.m
vecInsert(elemToInsert,position,vecIn)
Insert elements into a vector at given positions
Author: Michael Stachowsky
If I understand correctly, this function does nothing more than
It does have help, although it does not contain an H1 line. An H1 line allows you to find your function with 'lookfor' when you have forgotten the exact function name.
The code has a weird order of execution making it harder to read. Furthermore, the M-lint brings up a number of improvements, some of them which are critical (use && instead of &)
The help is a bit cryptic, making it difficult to understand. It does have a partial H1 line. It also has some argument checking. However, the code is incomprehensible and the few lines of comments do not help understanding it in any way.
I did not check if the file produces the right results, I only looked at the code.
The code does contain sufficient help and even an example. However, it does not have an H1 line meaning that you cannot use 'lookfor' to find the file in the future when you have forgotten the exact filename
It also does not contain any code to check if the input and output arguments are valid.
Furthermore, some code can be improved. Look at the suggestions of the M-lint checker and see if you can change the code.
Hi Robin,
If those matrices are to be multiplied, you have to try dimensions in the order of 2X3*3X2.
Matrix dimensions are No of rows X(by) No of columns.
Try to match No of columns of first matrix with No of rows of the second. The the product will be a matrix of No of Rows of first BY No of columns of second: a 5 BY 7 times matrix CAN be multiplied with a 7 BY 2 and you'll get a 5 BY 2 matrix.
You can also try the dot product by adding a dot in front of the operator as in .*
Hope this helps.
Comment only
16 Nov 2011
sun_position.m
Sun position given observer time/location.
Hello,
Thanks for a great script! My question is whether this will also work to run serial zenith angles for every hour of a day for n days? I am a pretty new Matlab user so my skills are not great yet. To do this will I have to modify the script much? I tried running it once with time.day = 1:5 and time.hour = 0-23 but there is a "matrix dimensions must agree error". Before I go on a hunt to try and resolve it I thought I would check to see if anyone else has done this?
Thanks,
Robin
Comment only
17 Jun 2011
sun_position.m
Sun position given observer time/location.
Hi folks,
I was thinking about the rigid approach of Reda and Andreas in respect to delta_t, or the difference between UT and TT < http://en.wikipedia.org/wiki/%CE%94T >
I did a error check for the period between 2010 and 2020 by adopting the proposed in SPA's documentation 64.797s and by a fourier expression of delta_t which I derived using data generated by the HORIZON's software at the JPL(UNI PASADENA) < http://ssd.jpl.nasa.gov/horizons.cgi#top >.
The function generated is inherently periodic and describes the the ephemerides data with a high precision ( st.dev = 1.5e-5).
I am currently analyzing the effects of this deviation on SPA's precision and a noticeable improvement can be observed in the e-5 order of magnitude for azimuth and zenith.
The payback of implementing the function is great, compared to the minor increase in computational cost.
After line number 203-204 of the sun_position function implement the following:
*******************************************************************************
% Compute serial date number since 2010-01-01 00:00:00
JD2010 = julian.day - 2455196.5;
% Compute delta_t using fourier expression derived from HORIZON ephemeris
% PRECISION: rmse = 9.811e-006s; std = 1.5e-5s;
delta_t = 66.18 - 0.0001033*cos(JD2010*0.0172) + 0.001654*sin(JD2010*0.0172);
*********************************************************************************
Regards,
Lubo
Comment only
16 Jan 2010
sun_position.m
Sun position given observer time/location.
Comment only