Greetings,
I am running the attached data with a .txt file runner (P3.m and Problem_4m)
The data runs and generates the numbers I want, the problem is how can I plot certain data.
For example for if you run Problem_4m it will generate the solutions for all my txt files (from P4_N1 - P4N200) and I need to plot
My N values go from N1, N5, N25, N50, N75, N100, N125, N150, N175, N200
the first plot is with N values and CL (these numbers are under workspace)
the second plot is with N values and CDi (these values are under workspace)
the third plot is N values with Gamma (These values are under workspace)
Is there a way to combine the results of ALL the .txt files into one single plot with the plots provided above

2 个评论

hello
I tried to run your code , but could you please clarify in which order you execute the tasks. it's not very clear
I also get error message from your code :
Right_Side.m Line: 52 Column: 1
??? Reference to non-existent field 'delta'.
On line 49 ==> DATA.CDi=((DATA.CL^2)./(pi*DATA.AR))*(1+DATA.delta);
last but not least, I don't understand your plot functions (P4_graph_CDi.m / P4_graph_CL.m / P4_graph_Gamma_y.m)
why do you have written a single numerical value for CDi , CL (must be alos a copy paste error there) and Gamma,
I was assuming that this would be vectors , computation results from your various functions - or where am I wrong ?
did you copy paste the values from the workspace ? why only one value appears ??
There are two different problems attached
one is from P3.m
The second one is Problem_4.m
Yeah, I sometimes get the same error as well. But, I type, clear clc and run it again and it goes through. I am not sure why MatLab sometimes does not recognize it
no you arent wrong about the vectors and that is another issue I am trying to find as to why I am only getting one value for CL/think my coding still needs some modifications)
I did copy and paste the values initially, but after working it a little more I created the following (giving you an idea for problem 4)
Plotting for N and CL
x=[N1_DATA.N ............ N200_DATA.N]
y=[N1_DATA.CL-------------N200_DATA.CL]
plot(x, y, 'r')
title('COVERENGE OF CL WITH INCREASING N')
xlabel('N')
ylabel('CL')

请先登录,再进行评论。

 采纳的回答

Mathieu NOE
Mathieu NOE 2020-10-6

1 个投票

ok - so this is my suggestion for problem 4
there are for sure a more elegant way to manage file names and variables names together. Could be nice if you want to address various files names / quantities without having to do manual corrections in the code.
I tried to "streamline" a bit the process , so there is only one subfunction (exec2.m) and one main m file (Problem_4b.m)
still you have to manage the case with N= 1 , therefore no "delta" variable => error msg

7 个评论

Thank you.. so MatLab isnt going to detect the correction that is there for N=1?
for n=2:DATA.N
DATA.delta_1(n,1)=n*(DATA.A(n,1))/DATA.A(1,1))^2;
if DATA.N<2
DATA.delta=0;
else
DATA.delta=sum(DATA.delta_1);
end
end
I prefer to change your logic - when it starts with DATA.N = 1 , I find strange (a bit ugly) to do a for loop from n = 2 to 1 .
So i ended up modifying a bit the logic , so no more error msg
let me know if it works for you (see attached update)
THANK YOU SOOO MUCH!!!!
you're welcome ! :)
"here are for sure a more elegant way to manage file names and variables names together."
Yes: avoid numbering variables like that. Just use indexing, exactly as the MATLAB documentation shows:
@ Stephen , thank you for the link.... always good to look at the documentation from time to time.
@ Eddy - hum I can help you for debugging your code , but no, sorry, I am not here to do your home work
My apologies that was not my intent so I apologize if it came out that way. I was able to find some guidance on how to attack the problem.. I might bother you for some debugging if possible. Once again, I apologize if it came out like I wanted you to attack my assigment.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by