# Contour plotting from given datapoints

2 views (last 30 days)
Paras Choudhary on 25 Sep 2022
I have certain values of L and corresponding to each L value there is a value of R and Q respectively
How to contour plot them
on X axix we should have Q, on Y axix R and contours of L.
Values are
L1 = 26
R = 16 ;17 ; 19 ;25 ;26 ; 27 ; 30 ; 31 ; 32
Q = 9.74 ; 11.047 ; 13.88 ;24.45 ; 26.49 ; 28.56 ; 35.44 ; 37.88 ; 40.41
L2 = 28
R = 15;16;17;19;21;22;29;30;31
Q = 7.82 ; 8.9492 ; 10.16 ;12.78 ; 15.7 ; 17.28 ; 30.55 ; 32.74 ; 34.94

Bala Tripura Bodapati on 28 Sep 2022
Hi Paras
It is my understanding that you would like to know how to create a contour plot based on the data provided for X-axis, Y-axis, and Z-values.
The X, Y and Z values must be in the form of a matrix for creating a contour plot. The following code illustrates how to create a contour plot for the data provided:
R = [16 ;17 ; 19 ;25 ;26 ; 27 ; 30 ; 31 ; 32]'
Q = [9.74 ; 11.047 ; 13.88 ;24.45 ; 26.49 ; 28.56 ; 35.44 ; 37.88 ; 40.41]'
R = [R;[15;16;17;19;21;22;29;30;31]']
Q = [Q;[ 7.82 ; 8.9492 ; 10.16 ;12.78 ; 15.7 ; 17.28 ; 30.55 ; 32.74 ; 34.94]']
L1 = 26.*ones(9,1)'
L2 = 28.*ones(9,1)'
Z = [L1;L2]
contour(Q,R,Z)