필터 지우기
필터 지우기

need solution with symbolic

조회 수: 1 (최근 30일)
Ali Najem
Ali Najem 2020년 10월 8일
댓글: Ameer Hamza 2020년 10월 8일
Dear all
why the first code is working otherwise in second code when I just change a bit it won't work ?
The first code
syms z2
Z2(z2) = piecewise(0<=z2, z2, 0>z2, 0.2*(exp(z2)-1));
Z2([10])
The second code
syms w12 a1 b12 z2
z2 = w12*a1 + b12;
Z2(z2)=piecewise(0<=z2, z2, 0>z2, 0.2*(exp(z2)-1));
Z2([10])
Any suggestion please?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 8일
Here:
Z2(z2)=piecewise(0<=z2, z2, 0>z2, 0.2*(exp(z2)-1));
%^
z2 is not an independent symbolic variable. It is a symbolic expression. You should use the base variables to make symbolic functions. For example
syms w12 a1 b12 z2
z2 = w12*a1 + b12;
Z2(w12,a1,b12)=piecewise(0<=z2, z2, 0>z2, 0.2*(exp(z2)-1));
Z2(10, 1, 2)
  댓글 수: 2
Ali Najem
Ali Najem 2020년 10월 8일
편집: Ali Najem 2020년 10월 8일
it worked thanks alot sir
Ameer Hamza
Ameer Hamza 2020년 10월 8일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by