Working With Cosine In a Matrix

I'm trying to work with cosines in a matrix (For the Freudenstein Equation)but but then am getting a pretty consistent error. Here's the line that has a problem:
TermA = [cos(precOutputAngle1Rad),(-cos(precInputAngle1Rad)),1;
cos(precOutputAngle2Rad),(-cos(precInputAngle2Rad)),1;
cos(precOutputAngle3Rad),(-cos(precInputAngle3Rad)),1];
The error just reads 'Error in FindTransmissionAngles (line 3)' and the line in bold is the said line. I'm thinking the error is something obvious so Id like someone to point out to me and Id really appreciate that.
NB: dpb edit to format the code line removed bold to introduce code format but did not change anything other than spacing for legibility...

5 Commenti

Stephan
Stephan il 15 Lug 2018
Modificato: Stephan il 15 Lug 2018
Hi,
is there some more red error text?
To help you it is useful to get the whole error message and the related code. Please format the code after inserting it, by marking it and pressing {}Code - this makes it easier to read.
If you can not insert it, you can attach .m-files and data files needed to execute the code and reproduce your problem.
Until now we only know, that you probably want a matrix A of form
[cos(Out1) -cos(In1) 1;
cos(Out2) -cos(In2) 1;
cos(Out3) -cos(In3) 1]
and that for some reason this doesnt work. But we do not know anything about the In / Out values and its data type or what exactly is going wrong.
As you can see here in the following example it should work:
>> A = [cos(39), -cos(12), 1;...
cos(35), -cos(19), 1;...
cos(89), -cos(10), 1]
A =
0.266642932359937 -0.843853958732492 1.000000000000000
-0.903692205091507 -0.988704618186669 1.000000000000000
0.510177044941669 0.839071529076452 1.000000000000000
So to help more information is needed.
Best regards
Stepan
As far as I am aware all the variables am using are of the default, which I believe is double. Maybe its because am using global variables, I am not sure. I have attached the two .m files am using.
Stephan
Stephan il 16 Lug 2018
Hi, i cant find any attachments
Guillaume
Guillaume il 16 Lug 2018
Edwin, as per Stephan's initial request, give us the full text of the error message. Everything in red.
So far, we know that the line produces an error, but the important bit that tells us why it produces an error, you haven't given us.
I regret my lack professionalism; I came here in a haste. Anyway, I have somehow solved the error. Unfortunately I was not able to identify the problem but the comments helped me narrow down the problem my definition of the variables. For that, am really grateful.

Accedi per commentare.

Risposte (0)

Prodotti

Release

R2016a

Richiesto:

il 15 Lug 2018

Commentato:

il 16 Lug 2018

Community Treasure Hunt

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

Start Hunting!

Translated by