I was assigned to do homework on the Math lab and to plot the graph but line is not showing up and graph is blank. Here is the code,
>> x=273:293:313;
>> y=100:150:200:250:300;
>> plot(x,y),x label('pressure'),y label('volume')
>> grid on
So in Matlab the ":" operator denotes a range. For example, x = [1:20] would create an array of elements from 1-20. Furthermore, you can specify the "step" with which the array fills as well by doing x = [1:0.5:20] This will create an array with elements filling up from 1 to 20 by a step of 0.5 (x = 1,1.5,2,2.5 .... ,19.5,20).
So when you say in your code that x=273:293:313 you are specifying a range (273-313) with a step of 293! Matlab interprets this as an array with only one element: 273! This is because the next step in the array would be 293 more than the first element which is outside of the range specified. Therefore, if you simply want to list your elements in the array you can do so with spaces or commas: x = [273 293 313]. This will create an array with three elements.
The problem asks you to use the ideal gas law formula. The code you have provided isn't making use of the provided parameters! I don't want to give you the direct answer to your HW question without you demonstrating that you at least understand what they are asking for.
xand an error on theydeclaration.