how to write in my x line pi instead of the actual number ?

2 views (last 30 days)
tomer polsky on 10 Mar 2019
Answered: tomer polsky on 13 Mar 2019
hello I have 2 question .
1)first what is the diffrnce between the opretion * and .* ? as i undestand it the diffrnce is that you use * when multiplaying scalras and using .* when multiplaying vectors , am i right ?
2) the second question is that I wrote this code :
my question is how can I display my x line as function of pi (meaning 1pi ,2pi,3pi,4pi and so on ) ?
clc;clear all;close all
x=0:0.01:(6*pi)
beta=pi/7
alpha=pi/5
y_1=sin(x*alpha).*cos(x*beta)
y_2=cos(x*alpha).*sin(x*beta)
y_3=y_1+y_2
y_4=sin(x*alpha+x*beta)
figure(1)
plot(y_3)
figure(2)
plot(y_4)
0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Accepted Answer

madhan ravi on 10 Mar 2019
* for matrix mulitplication
doc mtimes
.* for element wise multiplication
doc times
xlim([0 6*pi])
xticks(0:pi:6*pi)
xticklabels((""+(0:6))+"\pi")
1 CommentShow -1 older commentsHide -1 older comments
madhan ravi on 10 Mar 2019
https://in.mathworks.com/help/matlab/ref/xticklabels.html#bu71pui-1 - that's why it's worth reading the documentations.

Sign in to comment.

More Answers (1)

tomer polsky on 13 Mar 2019
thank you for your answer
0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!