Why does vpasolve fail when I try to use sind() in my equation to be solved numerically?

5 次查看(过去 30 天)
I want to get some numerical solutions for an equation that I have at various values of parameters. My expression to be solved includes sines and cosines. I came across the help page for vpasolve, here:
The second example even includes a function with cos() in it. However, I wanted to express my arguments in degrees rather than radians. So I used sind() and cosd() functions, but it failed. It gave me an error about undefined function "sind". If I revert to sin() and cos() functions and express my argument as radians, it works. Why is this? Does Matlab not know how to convert a "regular" number into degrees at the end? Or what? My objective was to extract a value for degrees (or radians) that would satisfy the equation.

回答(2 个)

John D'Errico
John D'Errico 2016-4-14
Is it really that difficult to write this
sin(D*pi/180)
instead of sind(D)? Yes, it would be nice if the symbolic TB recognized sind. Maybe that will happen in a future release. Until then, you will just be forced to type a few extra characters. Life is tough. :)
  3 个评论
John D'Errico
John D'Errico 2016-4-16
编辑:John D'Errico 2016-4-16
Do some versions of MATLAB charge by the number of characters you type? :) Must be so.
Hey the good news is, there are probably some coding jobs that pay by the number of characters typed, as that clearly means one is doing a great deal of work if they are typing a lot.
And, hey, back when I was a kid, we did not have computers, or even pencils. I had to write my own homework using my own blood, pricked from my finger. My slide rule was two sticks, of roughly the same lengths, where I had chiseled marks along the length using a log scale. Some kids had an abacus, but I only had a chunk of board, with some pebbles I picked up from the ground. Then I got a computer, but it was the kind where you had to turn a crank on the side. So be happy that you have a sin function at all. :) :)

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2016-4-15
You can always define sind locally
sind = @(D) sin(D*sym('pi')/sym(180))

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by