- the result of int() of a symbolic expression is always a symbolic expression. If no integration variable is specified, then symvar() is used to find the default variable to integrate with respect to
- the result of int() of a symfun is not always a symfun. If no integration variable is specified, then the variable that is the first parameter is used as the variable to integrate with respect to. The variable that was integrated with respect to is removed from the parameter list of the symfun being integrated; if there are no remaining parameters, then the result of the int() is a symbolic expression, but if there is at least one remaining parameter of the original symfun after removing the variable, then the result is a symfun of the remaining variables, in the same order as in the original symfun

# How to write a symfun for given Y values array?

5 views (last 30 days)

Show older comments

Hi guys.

- The temputure array A is given (Y value) in hours,
- of course, X are uniformly distributed in hours, e.g x1 = 1, x2 = 2, x3 = 3. x4 = 4 ...
- e.g a1 = f(x1=1), a2 = f(x2=2), a3 = f(x3=3), ...

My question is, how to write this weather vs hour function ?

Note that, 1. this funcation must be a symfun type, (f is symfun, x is sym) because I need to give this symfun into the "int" function later.

2. since this funcation will feed into "int", I think it should be able to give any Y value for given X. e.g, Y = whatever number = f(1.64), this 1.64 is a number between x1 and x2, in other words, this function is not discrete (not spikes) but a continuous. It doesnt need to be "smoothly" continuous, even straight line connected is fine.

Thank you!

##### 0 Comments

### Answers (1)

Walter Roberson
on 19 Aug 2021

I do not understand your point about needing a symfun?

The difference between int() of a symbolic expression() compared to int() of a symfun, is:

Otherwise there is no difference. int() of symfun() proceed by determining the variable to integrate with respect to, stripping the symfun layer off and doing int() of the resulting symbolic expression, and then wrapping the result in a symfun if there are any variables left in the original parameter list.

Using a symfun can certainly be convenient for some uses, saving having to explicitly subs() a value for a variable, but it integrates just like symbolic expressions do with the minor change of how it determines the integration variable if one is not specified

### See Also

### Community Treasure Hunt

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

Start Hunting!