Effacer les filtres
Effacer les filtres

Error using cos.Not enough input arguments.

2 vues (au cours des 30 derniers jours)
Cristian Rosca
Cristian Rosca le 4 Sep 2020
Commenté : Fangjun Jiang le 4 Sep 2020
Hi all,
Can anyone help me with this problem - Error using cos Not enough input arguments.
A2=sinh((x^2)+cos^2*y)^3/sqrt(abs(x-cos(y))+ln*(abs((x-cos(y)))/(x^2)+(cos^2)*y+abs(sin)*x))
Error using cos
Not enough input arguments.
i am new to matlab and i need to rezolve these expresition.
  1 commentaire
Stephen23
Stephen23 le 4 Sep 2020
Modifié(e) : Stephen23 le 4 Sep 2020
The function cos requires one input argument. As the error message states, you have called cos with no input argument, which throws an error. I have marked those locations for you, showing where you have called it incorrectly:
A2=(sinh((x^2)+(cos^2)*y)^3/sqrt(abs(x-cos(y)))+ln*(abs((x-cos(y))))/(x^2)+(cos^2)*y+abs(sin(y))*x)
% ^^^^ ^^^^
Your use of matrix operations is also quite likely to be incorrect:

Connectez-vous pour commenter.

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 4 Sep 2020
try this line by line
y=pi
(cos(y))^2
cos^2*y
  4 commentaires
Cristian Rosca
Cristian Rosca le 4 Sep 2020
Modifié(e) : Cristian Rosca le 4 Sep 2020
when x=-1.75*10^-3
y=3*pi
Fangjun Jiang
Fangjun Jiang le 4 Sep 2020
create some interim variables and build up your result
x=-1.75*10^-3;
y=3*pi;
cos_y=cos(y);
temp1=x^2+cos_y^2;
temp2=x-cos_y;
A2=sinh(temp1^3/sqrt(abs(temp2)))+log(abs(temp2/temp1))+abs(sin(y))*x

Connectez-vous pour commenter.

Plus de réponses (1)

Steven Lord
Steven Lord le 4 Sep 2020
In mathematics we write but when we implement that in MATLAB we implement it as [not to be confused with .]
x = pi/4;
y = cos(x)
z = cos(x).^2 % compare to y^2
w = cos(x.^2)
  3 commentaires
Steven Lord
Steven Lord le 4 Sep 2020
Run those four lines. See that z is the square of y. That is how you compute the square of the cosine of an angle. cos^2(x) is not valid MATLAB syntax.
Cristian Rosca
Cristian Rosca le 4 Sep 2020
anyway is incorrect:((

Connectez-vous pour commenter.

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Tags

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by