multiple variable function

p=p*(cos((x(:,1))-sin(x(:,2)))
is it
p=p*(cosx1-sinx2)?
what is the difference between?
if its same,then why first one is used?

댓글 수: 1

Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 1월 29일
supposey=sin(x(:,i)
if i pass x=[1 2 3 4 5..............n]
will it work?actually things is nt being clear.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 1월 29일

0 개 추천

The first uses trig functions, while the second does not.
The first uses two columns of a variable named "x", while the second uses a variable "cosx1" and another variable "sinx2".
The first is missing a ')', while the second has balanced brackets

댓글 수: 4

Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 1월 29일
first one uses two variabe scond one also.cos(x1)-sin(x2)
and cos(x(;1)-sin(x(;2)) what is the difference of uses?if the function is same
Image Analyst
Image Analyst 2012년 1월 29일
You are so sloppy with your typing, that it's probably your main problem. cosx1 is NOT THE SAME as cos(x1). And x(;1) would cause a syntax error while x(:, 1) is perfectly valid.
Krishnendu Mukherjee
Krishnendu Mukherjee 2012년 1월 29일
still thing is nt clear.cos(x1) and cos(x(:,1)) what is the difference of their uses?yes my keybord is very old.that is why all prints hs washed away
Image Analyst
Image Analyst 2012년 1월 29일
You should get a new keyboard - they would be a very cheap fix. cos(x1) is the cosine of the variable x1. x1 is not necessarily the same as x(:,1) unless you said x1 = x(:,1); x1 could be anything at all. It could be pi, it could be 42, or 69 or anything else. Why would you think that x1 should automatically be the same as x(:,1) unless you made it so?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

제품

태그

질문:

2012년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by