Change the sign of a Vector over N intervals
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I'm new to Matlab, my question may be super easy….I want to get a vector (Ytot ) witch is composed of the same function but with different signs set on différents intervals , that's not a problem for 2 or 3 vectors , but i dont know how to manage it with n intervals ?
This is an example :
Y = function_example;%%%% (define on 1 : 100)
T = [1; 9 ;17 ;...….89; 100] ;%%%(for example 24values)
A = [-1; 1 ; 1; ......…..-1]; %%% signs for each intervals
Y1 = -1*Y(1:9); %%% equal to Y between 1 and 9, and equal to 0 between 10 and 100
Y2 =1*Y(9:17);
Y24 =-1*Y(89:100);
t1 = (1: 1: 9);
t2 = (9: 1: 17);
tn = (89 :1: 100);
Ttot = [t1 +t2+...t24];
Ytot = [Y1 + Y2 + ….Y24];
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 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!