Alternative way of defining a variable

3 ビュー (過去 30 日間)
Saurabh Madankar
Saurabh Madankar 2021 年 10 月 19 日
回答済み: Walter Roberson 2021 年 10 月 19 日
Hello,
Is there any way I can define a variable without assigning it any value and not using syms?
  1 件のコメント
KSSV
KSSV 2021 年 10 月 19 日
In what contest? What is the requirement?

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2021 年 10 月 19 日
a = zeros([],1) ;
b =[] ;
But it depends. What is the requirement?
  3 件のコメント
KSSV
KSSV 2021 年 10 月 19 日
How about anonymous fnctions ?
Walter Roberson
Walter Roberson 2021 年 10 月 19 日
str2sym('t')
ans = 
t
Does not directly use sym() or syms() . It uses sym() internally though.
Is the point that you need to be able to use piecewise() but for some reason you cannot use symbolic variables? Note that piecewise() is part of the symbolic toolbox, so if you have a restriction against using the symbolic toolbox then you cannot use piecewise()

サインインしてコメントする。


Walter Roberson
Walter Roberson 2021 年 10 月 19 日
Problem based optimization permits you to use optimvar() to define variables to be optimized over, without giving the variables specific values.
This probably satisfies your question as originally asked.
Unfortunately, piecewise() cannot be used with problem-based optimization.

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by