Clear Filters
Clear Filters

How to solve the output of function "int", can not be "double" ?

2 views (last 30 days)
Hi guys:
I have a question about function "int" and "double". Imagine I have a 2 line code as below
a1 = int ( "some code here");
a2 = double (a1);
I have a problem at this 2nd line, it says "Unable to convert expression containing remaining symbolic function calls into double array. Argument must be expression that evaluates to number."
The output of this a1 is
int((5000*exp(-23931/(5*(- (2969455571328467*u^8)/5444517870735015415413993718908291383296 + (6426478858171711*u^7)/664613997892457936451903530140172288 - (5723691213461993*u^6)/81129638414606681695789005144064 + (5410674489502443*u^5)/19807040628566084398385987584 - (2916731417316609*u^4)/4835703278458516698824704 + (7157656872368969*u^3)/9444732965739290427392 - (2342765945804471*u^2)/4611686018427387904 + (5565587976219517*u)/36028797018963968 + 1357300938508151/4398046511104))))/51, u, 0, 5999)
Anyone could give me some hint how to solve this problem? Thanks for your time.
  6 Comments
sun
sun on 24 Aug 2021
Edited: sun on 24 Aug 2021
@Walter Roberson hi Walter, I had few new discover about my question today. Remember this temperature Y value was not a constant ? I just changed it to a constant (295, just one example), and do the same thing with polyfit, polyval, then poly2sym. I still have the same issue, "Unable to convert expression containing remaining symbolic function calls into double array. Argument must be expression that evaluates to number."
However, if I just use the code below, I do will successfully generate all the result. So, I am confused, why piecewise will work, but not "polyfit, polyval, then poly2sym" ? or is there a way I could use piecewise for my non-constant temperture values ?
x(u)= piecewise(0<=u<=100000,295); % even just x= 295 works as well.
sun
sun on 24 Aug 2021
@Walter Roberson dear walter, sorry about my mutiple replies here. I think the best way to express my question is, just give out the whole picture. if this is convenient for you, could you please the link below. thank you again for your time and kindness.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!