How to sum different functions

There exist functions A1,A2 and A3.
I want to proceed each functions for sigma.
it phrase as like this sigma Ai i=1 1 to 3
A1,A2 and A3 was have its own solution,so it same as constant. actually,i can solve via my note and hands,but i need to solve this problem through matlab.

2 个评论

Are you implying sigma here as the summation symbol so that you're looking for sum(A1,A2,A3), maybe? Or, since you speak of each having a solution, is there some constraint involved?
We need more specifics on the functions and the solution desired; illustrating the hand solution perhaps would be the simplest way.

i want to Atot i understand and can approach to solve this problem but i cannot translate matlab...

请先登录,再进行评论。

 采纳的回答

dpb
dpb 2016-10-3
编辑:dpb 2016-10-3
Your textbook problem is specific to a given geometry; is the problem you wish to solve the same one exactly or are you looking to generate a more general toolset?
There are multiple ways to attack the problem, but you've got to start with the pieces--it's possible for a user to specify a functional form in text and build a function handle to it with str2func and it is then possible to build arrays of function handles and evaluate them over a set of inputs via strctfun. Those outputs can subsequently be operated upon with sum or whatever other operations are needed.
That's a fair amount of effort, but not tremendous with some digging through the doc's and reading the examples and experimenting on how to put the pieces together for your specific purpose, provided, of course, you're not trying to make a commercial-grade application here. :)
OTOH, to simply code up the specific example from the text, you can start out with
A=[a*t; b*t; (h-2*t)*tw]; % the individual areas vector
Atot=sum(A); % total area
Carry on similarly for the y components and just translate the steps into Matlab code.
You'd be well served to create this as a function file ("m-file"), no doubt, to which you can then pass the given constants either as a list or a structure or the like.

3 个评论

thank you. i'll try to do it.
actually, i want to general approach to translating solving method at the matlab.
Well, that'll take sitting down and really working out a design of what you would expect a user interface to look like and how you would want to use the result...as noted earlier, that would likely become a fairly involved development project and probably need some "time in grade" getting more familiar with the basic syntax of Matlab in particular and (I'm guessing) coding in general.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by