Thread Closed

Matlab --> quick question

 
Share Thread Thread Tools
Mar28-08, 01:08 AM   #1
 

Matlab --> quick question


1. The problem statement, all variables and given/known data

suppose I want to set a = [0:64] with an output of 9 increments. For the life of me I cannot remember how to do this other than doing it brute force style.


2. Relevant equations



3. The attempt at a solution

since 64/9=7.11 then, a =[0:7.11:64] gives me 9 increments but I know there's a better way to do this. please help, thanks.
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Mar28-08, 01:15 AM   #2
 
help linspace
Mar28-08, 01:19 AM   #3
 
yes, thanks
Mar30-08, 08:31 AM   #4
 

Matlab --> quick question


is there a way that i can plot more points in the x-axis and the y-axis? instead of going by 5 -10 -15- 20 and go 5 - 6 - 7 - 8 - 9...20 .
Mar30-08, 11:01 AM   #5
 
well, I'm no matlab expert, but here goes.

When you specify x and y, making x= [5:1:20] will give you 5, 6, 7, 8... 20. you can do this for y also. then when you plot (x, y) it should give you what you need.

i hope that helps, let me know if i misunderstood your question.
Mar30-08, 11:16 AM   #6
 
if i plot x= [5:1:20] and y= [5:1:20], the axes spacing goes 5,10,15,20, but i would like to make it go 1 by 1. thus showing more points in the plot.

not sure if that is possible, but thatīs why im asking i guess.

thanks for your help btw
Mar31-08, 08:18 AM   #7
 
Quote by tko_gx View Post
if i plot x= [5:1:20] and y= [5:1:20], the axes spacing goes 5,10,15,20, but i would like to make it go 1 by 1. thus showing more points in the plot.

not sure if that is possible, but thatīs why im asking i guess.

thanks for your help btw
I think you're just referring to the tick marks on the axis. The distribution of tick marks is not related to the number of points plotted on the graph. You can change the tick mark distribution either going to 'axis properties' in the 'edit' menu of the plot, or you can define them from the command line. For example,
Code:
x = -pi:.1:pi;
y = sin(x);
plot(x,y)
set(gca,'XTick',-pi:pi/2:pi)
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
defines the tick placement and the labels.
Mar31-08, 10:37 AM   #8
 
thank you very much. thats exactly what i meant to say.
Thread Closed
Thread Tools


Similar Threads for: Matlab --> quick question
Thread Forum Replies
Quick matlab question Math & Science Software 5
quick does someone have access to matlab? need quick row reduce. Math & Science Software 1
Quick MATLAB Question Math & Science Software 1
A quick question on the twin paradox (quick I promise!) Special & General Relativity 7
Quick and Easy Matlab Question Math & Science Software 1