Need help in plotting contour of speed, torque and eff

I am struggling in plotting a contour of eff, speed and torque. Please see the attached workspace.mat attached to this file.

Answers (1)

scatter(eff,speed,[],torque,'filled')
You cannot plot contour with the given data. You have 1D data. You need to have 2D data i.e. matrices to plot contours.

10 Comments

Thakns for your answer. I have converter the data into 10x10 matrix. Can you please re-check it.
I am getting this contour map with my data:
While i am trying to get someting like this below:
Check the values of both the plots...... you need to think on your data.
The plot i am aimaing for is just an example, i am not using the same dataset. In my case, i want to understand what exactly is the issue with my data set so that i can trace back to the source of error. I am running a simulink model in loop for 10 times, each time with a dirrerent value of speed to the motor and recording the speed, torque and eff in the workspace. Then i am using a resphape function to convert my array data into matrix, then plotting data. Can you please point out if there is some inconsistancy in my data?
I am using the following code [see attachment]
Try like this:
x = eff ; y = speed ; z = torque ;
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
Getting error in producing Z because the size(X) is not interger. If i use a integer the size of matrics Z will not be the same as of X or Y. Can i use Z=meshgrid(Z)?
Attach the data for which you got this error. You should not use:
Z=meshgrid(Z);
Data is same as i attached with the last reply. Here is the error i am getting.
I used a [] in reshape then i got the following error:
Offcourse with that data you will get error. The given data is corresponds to curve.
How to fix this error? Just to summerise, i have the data of eff and torque for each value of speed. Now i want to plot the contour. I checked with multiple methods but the contour i am getting is not a valid one. I want to explore the incosistency in my dataset. For example the file attached with this mail produces a good contour. And when i compared my speed, torque and eff with the one provided in example, nothing looked out of context. However contour plot is completely different.
If you can find some issue, please let me know. Big thank you for your efforts.

Sign in to comment.

Categories

Asked:

on 16 Sep 2021

Commented:

on 16 Sep 2021

Community Treasure Hunt

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

Start Hunting!