How to display a polynomial function using printf in Scilab? {Without using disp}

StackOverflow https://stackoverflow.com/questions/22504445

  •  17-06-2023
  •  | 
  •  

Question

Here is my code. It throws error. I want to printf the polymial.

clc
clear
printf("Example 4.4 | Page number 103 \n\n");
//find Cv and Cp
//Given data
t = poly(0,'t'); //°C //Temperature in °C
u = 196 + .718*t; //KJ/kg //specific internal energy
pv = 287*(t+273); //Nm/kg //p is pressure and v = specific volume

//Solution
Cv = derivat(u);
printf("Cv = %.3f KJ/kgK\n",Cv); 
Was it helpful?

Solution

The return type of derivat is another polynomial. You can check with:

disp(typeof(Cv))

The scilab types are listed here.

You can get the sole coefficient out by using coeff

printf("Cv = %.3f KJ/kgK\n",coeff(Cv));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top