Hello every one my problem is in output.
z=[6
21
36]
but ı want to z as
z=[4
21
12]
how can ı fix this problem.Thanks for your answer and the file Untitled2.m uploaded.

 Respuesta aceptada

KSSV
KSSV el 5 de Mayo de 2021
x=[1 2 3 4 5
6 7 8 9 10
11 12 13 14 15];
a=1;
b=2;
c=3;
z = zeros(3,1) ;
idx = x(:,1)<3 ;
z(idx) = x(idx,2)*b ;
idx = x(:,1) >= 3 & x(:,1) < 7 ; % 3<= x(:,1)<7
z(idx) = x(idx,2)*c ;
idx = x(:,1) > 7 ;
z(idx) = x(idx,2)*a ;

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 5 de Mayo de 2021

Respondida:

el 5 de Mayo de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by