Clear Filters
Clear Filters

Unable to use Poly function on matlab 2020b, and 2019b

4 views (last 30 days)
My current issue is that I'm unable to use a couple of functions and I was troubleshooting the problem but no luck.
I have this snip from a code which doesn't work on only my end
numerator=1;
denominator=poly([-2 -4 -6 -8]);
G=tf(numerator,denominator);
---
The error message
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct
matrices, use brackets instead of parentheses.
Now, I have friends who have the same version of matlab as me and 2019b and I copy and paste send them the code and it runs fine on their end. I ended up reinstalling matlab 2019b with all the student toolboxes but that didn't help. Anyone know how to fix this? I had purchased the 2019 matlab and then I had also linked my school's license for when we went online due to covid and was available for us that way too.

Answers (1)

Shubham Khatri
Shubham Khatri on 10 May 2021
Hello,
Usually, MATLAB points to the specific position that is causing the syntax error as:
denominator=poly[-2 -4 -6 -8]); ↑ Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Can you please share the exact error message when the code does not run. so that we can locate, if the source codes for "poly" or "tf" have somehow been altered, we still get the message that points us to the line where the error is.
Hope it helps

Products

Community Treasure Hunt

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

Start Hunting!