plot specific values of 3 values function

Dear Matlab exoerts and users.
I wish you first a happy succesfull new year.
I have the following code that calculate M1 using beta (var), and fr, fh.
what I would like to do is to represent all the values of M1 in function of the three variables.
Then my second goal is to plot the combination of beta, fh, fr that gives M1 < 1.
I would highly apreciate your feedback.
clear all
fr=0.02:0.02:100
fh=0:1:2000
Beta1=0:0.1:359
k=1
for i=1:5000
for j=1:2001
for l=1:3591
M1(k)= (Beta1(l)/(2*pi))*(fh(j)/(fr(i)))
k=k+1
end
end
end

4 Comments

I don't know what you are trying to achieve with the code, but I don't think you have the memory to do whatever it is.
The number of elements in M1 after the completion of your code will be
val=5000*2001*3591
val = 3.5928e+10
%which will acount for val*8 bytes, which is around
memory=val*8/(1024)^3
memory = 267.6841
267.68 GB of memory. Do you have this much amount of memory in your system?
%You can check the math from the error here
y=zeros(1,val)
Error using zeros
Requested 1x35927955000 (267.7GB) array exceeds maximum array size preference (30.9GB). This might cause MATLAB to become unresponsive.
Alas, if you directly want the plot, then I guess something can be done for that.
I reduced the values for the step size, I have enough memory but I will try a smaller step sizes later when I am sure my code is working. (Thanks for the information)
--> what I am trying to do is to calculate all the values of M1(beta, fr, fh). and would like to have some plot to understand the evolution of M1 and then know how should be the values of beta fr fh when selecting one of this paramters.
later I will add some conditions and try to print the combination of beta, fr, fh that fulfill the condition.
Is your question how to plot it or what is your concern?
@Michael Loibl yes I would like to have a graphical presentation of M1 values

Sign in to comment.

Answers (1)

Michael Loibl
Michael Loibl on 2 Jan 2023
Edited: Michael Loibl on 2 Jan 2023
I don't directly know a good solution for plotting a function with four variables (in your case M1, beta, fh and fr).
Plotting combinations with M1<1, you could just use "plot3"-function (using beta, fh and fr) without specifying the actual value of M1.
Another alternative would be to make seperate plots for fixed beta, fixed fh or fixed fr. However, I don't know how useful this is for you because you have quite a large data range for all variables.
I think your problem is not really Matlab specific, but you are actually looking for a good representation of your results. So, maybe try to think about what your problem is representing and try to reduce dimensionality and/or data range in you representation.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Release

R2018a

Community Treasure Hunt

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

Start Hunting!