在matlab中确定同一图上每个函数的不同原点

时间:2018-01-30 14:24:44

标签: matlab

我有2个函数,我想从x = 0到x = 10绘制每个函数,但第一个函数我希望它从x = 0开始,第二个函数我想从x = 10开始但是从x = 0的值。 可能吗? 到目前为止我试过这个:

fplot(@(x) func1, [0 10])
hold on
fplot(@(x) func2, [10 20])
grid on

问题是我得到第二个函数的10到20的值,但是我希望0到10的值只是从x = 10开始,是否可能? 感谢。

1 个答案:

答案 0 :(得分:2)

也许只使用常规Account Voucher DocumentDate OriginalAmount Sum(Amount) Records abc 1 01.01.2018 00:00:00 100,00 0,00 2

WITH CTE AS 
(
    SELECT 
        [Account], 
        [Voucher],
        [DocumentDate],
        ROW_NUMBER() OVER (PARTITION BY [Account],[Voucher] ORDER BY [DocumentDate]) RN,
        [Amount]
    FROM            
        MyTable 
    WHERE           
        [Account] = 'abc'
)
SELECT 
        [Account], 
        [Voucher],
        [DocumentDate],
        max(case when RN = 1 THEN [Amount] else null end) OriginalAmount,
        sum([Amount]) SUM_Amount,
        count(*) Records
from cte
GROUP BY
    [Account], [Voucher], [DocumentDate]
HAVING          
    SUM([Amount]) = 0