- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all modeler,
I'm up to here to ask about how to solve the model output as "Infinity".
Some of the calculations are"Infinity" and Matlab can not recognize it when I load the output in Matlab.
I already look at this document:
http://www.intel.com/software/products/compilers/flin/docs/main_for/mergedProjects/bldaps_for/using_the_floating_point_exception_handling_(-fpe)_option.htm
Thx,
Michael
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is -Infinity a valid result of your analysis? According to search engine queries, Matlab should accept -Inf. So, where you WRITE values which may take this value, you could modify your WRITE along the line of
if(x < -huge(x)then
write(*,*)'-Inf'
else
write(*,*)x
endif
If necessary, you could
write(*,*) max(-huge(x),x) so as to replace -Infinity with the closest numeric value.
or, should we take your reference to exception handling to imply that you consider this erroneous, and want suggestions for debugging?
if(x < -huge(x)then
write(*,*)'-Inf'
else
write(*,*)x
endif
If necessary, you could
write(*,*) max(-huge(x),x) so as to replace -Infinity with the closest numeric value.
or, should we take your reference to exception handling to imply that you consider this erroneous, and want suggestions for debugging?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is -Infinity a valid result of your analysis? According to search engine queries, Matlab should accept -Inf. So, where you WRITE values which may take this value, you could modify your WRITE along the line of
if(x < -huge(x)then
write(*,*)'-Inf'
else
write(*,*)x
endif
If necessary, you could
write(*,*) max(-huge(x),x) so as to replace -Infinity with the closest numeric value.
or, should we take your reference to exception handling to imply that you consider this erroneous, and want suggestions for debugging?
if(x < -huge(x)then
write(*,*)'-Inf'
else
write(*,*)x
endif
If necessary, you could
write(*,*) max(-huge(x),x) so as to replace -Infinity with the closest numeric value.
or, should we take your reference to exception handling to imply that you consider this erroneous, and want suggestions for debugging?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
-Infinity is a valid result in the numerical model. Matlab accept -Inf after loading the file, however the it's such painful to load a file contains strings. Your tips is helpful. Right now, I generally parse the -Infinity as NaN in another text editor.
-Michael

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page