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

5 views (last 30 days)
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.

Answers (2)

John D'Errico
John D'Errico on 14 Apr 2016
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 Comments
John D'Errico
John D'Errico on 16 Apr 2016
Edited: John D'Errico on 16 Apr 2016
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. :) :)

Sign in to comment.


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

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!