MATLAB Central Discussions - Join the conversation!
メインコンテンツ

結果:


Hi, I'm in truble because I have two programs with the same variables and parameters. The main of the study is to change a value and plot the results. The problem is that I want them on the same plot but I use the same name for the variabes in the two different programs so when I use some function to join the figures togheter matlab resets the values obtained in the first program and runs only the second one.
Is there a method to avoid changing all the names of the variables in one of the two programs (because they have something like 500 lines)?
John D'Errico
John D'Errico
最後のアクティビティ: 2023 年 12 月 18 日

I saw this post on Answers.
I was impressed at the capability of the AI, as I have been at other times when I posed a question to it, at least some of the time. So much so that I wondered...
What if the AI were automatically applied to EVERY question on Answers? Would that be a good or bad thing? For example, suppose the AI automatically offers an answer to every question as soon as it gets posted? Of course, users would still be allowed to post their own, possibly better answers. But would it tend to disincentivise individuals from ansering questions?
Perhaps as bad, would it push Answers into the mode of a homework solving forum? Since if every homework question gets a possibly pretty good automatic AI generated solution, then every student will just post all HW questions, and the forum would quickly become overwhelmed.
I suppose one idea could be to set up the AI to post an answer to all un-answered questions that are at least one month old. Then students would not gain by posting their homework.
Chen Lin
Chen Lin
最後のアクティビティ: 2023 年 11 月 15 日

In just one week, we have about 200 amazing animations! We see many creative and compelling animations and more importantly a lot of FUN!
Now, let the voting begin! Vote on the animations you love. Also, share them with your friends, classmates, or colleagues. Show the world the beauty of mathematics!
Mini Hack Winners - Week 1
You probably can imagine how hard it is to pick the winners, given so many awesome entries there are! We came up with several categories:
Landscape:
Trees:
Illusion:
Cartoon:
MATropolis:
Geometry:
Congratulations to the winners! Each of you won your choice of a T-shirt, a hat, or a coffee mug. We will contact you after the contest ends.
Finally, we encourage all of you to share your experiences, thoughts, and feedback in our new contest discussions channel!
Josh
Josh
最後のアクティビティ: 2023 年 11 月 14 日

Loving all the animations I'm seeing so far and feeling so inspired and impressed by what y'all are sharing. Thanks for loading me up with new topics to learn about!
Hi everyone,
I would like to ask you if it would be possible to do an HiL simulation using an environment model simulated via Simulink and load in a target computer connected to the hardware needed. The target computer will be simply a laptop with Matlab&Simulink package installed and directly connected to the bench to test.
I have found some solutions about the use of Simulink Real-Time but it implies the use of a Speedgoat unit, so I was wondering if anyone has ever done it without that device.
Thank you very much.
Margherita Premi
Margherita Premi
最後のアクティビティ: 2023 年 11 月 15 日

Hi, I'm trying to analyze a .vtk data set from MRI. I already calculate the kinetic energy. Now I'm trying to calculate the viscous energy loss but the result that I found does not respect the reality so I think that I'm doing something wrong.
Can someone help me with this?
%% FUNCTION
function energy_loss = calculateViscousEnergyLossForAllPhases(MRI_Velocity, dynamic_viscosity,interval)
% Preallocate the energy_dissipation array
energy_loss = zeros(1, 30);
for idx_phase = 1:30
% Velocity field
vel_x = MRI_Velocity{1, idx_phase}.velocity(:,1) * 1e-2; % Velocity in X from cm/s to m/s
vel_y = MRI_Velocity{1, idx_phase}.velocity(:,2) * 1e-2; % Velocity in Y in m/s
vel_z = MRI_Velocity{1, idx_phase}.velocity(:,3) * 1e-2; % Velocity in Z in m/s
% Coordinates
x = MRI_Velocity{1, idx_phase}.points(:,1) * 1e-3; % from mm to m
y = MRI_Velocity{1, idx_phase}.points(:,2) * 1e-3;
z = MRI_Velocity{1, idx_phase}.points(:,3) * 1e-3;
% Compute partial derivatives
dUdx = gradient(vel_x, x, 1);
dUdy = gradient(vel_x, y, 2);
dUdz = gradient(vel_x, z, 3);
dVdx = gradient(vel_y, x, 1);
dVdy = gradient(vel_y, y, 2);
dVdz = gradient(vel_y, z, 3);
dWdx = gradient(vel_z, x, 1);
dWdy = gradient(vel_z, y, 2);
dWdz = gradient(vel_z, z, 3);
% Calculate energy dissipation
ED = 2 * (dUdx.^2 + dUdy.^2 + dUdz.^2) + ...
2 * (dVdx.^2 + dVdy.^2 + dVdz.^2) + ...
2 * (dWdx.^2 + dWdy.^2 + dWdz.^2) + ...
(dUdz + dWdx).^2 + (dVdx + dUdy).^2 + (dWdy + dVdz).^2;
% Scale by dynamic viscosity of fluid and store
energy_loss(idx_phase) = sum(ED, 'all', 'omitnan') * dynamic_viscosity * interval.^3;
end
end
%% CODE
dynamic_viscosity_blood = 0.0039;
% human dynamic_viscosity_blood from 0.003 to 0.004; % Approximate value for blood at body temperature
% Call the function to calculate viscous energy loss for blood flow for all phases
energy_loss_RV_J = calculateViscousEnergyLossForAllPhases(MRI_Velocity_RV, dynamic_viscosity_blood,interval/1000);
energy_loss_LV_J = calculateViscousEnergyLossForAllPhases(MRI_Velocity_LV, dynamic_viscosity_blood,interval/1000);
% From Joule to milliwatt (mW)
energy_loss_RV_mW = energy_loss_RV_J.*1e3;
energy_loss_LV_mW = energy_loss_LV_J.*1e3;
figure
plot(time, energy_loss_RV_mW, 'r','LineWidth',1.5);
hold on
plot(time, energy_loss_LV_mW,'b','LineWidth',1.5);
title('Viscous energy loss over Cycle','FontSize',14);
xlabel('Cycle','FontSize',12);
ylabel('Viscous energy loss [mW]','FontSize',12);
legend('RV','LV')
Amine
Amine
最後のアクティビティ: 2023 年 11 月 15 日

Hi Friends,
I'm looking for a matlab program which calculat deflection of simply supported tapered beam under uniform travers load.
Thank you for your help.
Zinab
Zinab
最後のアクティビティ: 2023 年 11 月 10 日

Hello, how can i write a combination of matrcies as follows L=[ai_j] of order 4,M of order 4, then S=[4*ai_j+M] of order 4. i mean each element in S is a matrex of order 4
The Flipbook contest is currently in full swing! It's been truly inspiring to see the incredible artwork you've all created using MATLAB! Checkout the gallery page if you haven't already.
We have some exciting news for our contestants today! In order to allow for more complex and unique creations, we've increased the MATLAB Evaluation timeout limit from 55 to 235 seconds!! So, don't hold back! Feel free to throw in those extra intricate lines of code without worrying about timeouts.
To all those already participating, we commend your efforts and encourage you to keep pushing your boundaries. And remember, there's always room for more. So, why not invite your friends and fellow MATLAB enthusiasts to join in the fun?
See the latest addition to the contest from @Cleve Moler, the creator of MATLAB!
We also encourage everyone to engage in the contest discussions channel. Share your experiences, insights, and feedback about this contest. Your contributions enrich our community and help us improve future contests.
Looking forward to seeing more and more entries in coming weeks!
Hello,
I have an equation model following a law of type power: s=aN^b
For the measure equation, I have also a power law: m=cN^d
So I would like to have an extended Kalman Filter code in Matlab for this case. CAN YOU HELP ME PLEASE ?
Ayush
Ayush
最後のアクティビティ: 2023 年 11 月 9 日

hi there, my name is ayush. Im a bachelor student from india. I was doing a semester project in topology optimization. can you tell me how you run the file (https://www.topopt.mek.dtu.dk/apps-and-software/new-99-line-topology-optimization-code-written-in-matlab)in matlab. In one of your answers you provided the source, from there i got the matlab file. i was thinking of doing a project on it, but i cant run the file. its showing error.
i provided the value of ftBC = 1. I have no priorknowledge of matlab. i want to learn it though.
We reached the 100 animations milestone in less than 3 days! We are thrilled to see so many creative entries and talented members learning from each other.
Note that this contest is not just for experts. People with all skill levels can participate, improve their MATLAB skills, and have fun!
We have created new resources and tips for you to get started.
  1. Contest introductory video. The 3-minute video provides you with a quick introduction to how the contest works and how to create a simple animation.
  2. Animations blog post. The post demonstrates some coding techniques that can make your animations easier.
  3. AI Chat Playground. This is a new community app we just released. You can leverage the Generative AI tool to write initial draft MATLAB code or modify existing one.
  4. Get ideas from previous Mini Hack contests. There is a large gallery of amazing images, which provide you with ideas and code to start with.
  5. Remix is highly encouraged. Learning from others is the most effective way to learn. Make some SMALL changes and see what it would look like.
Check out our 100th animation by Tim. Isn't it amazing?
We look forward to seeing more of you joining us and having more fun!
david hill
david hill
最後のアクティビティ: 2024 年 2 月 7 日

Hello.
I use readgeoraster to read in a 25MB geotiff. I then turn around and immediately write out the data with geotiffwrite. The resultant file is now 250MB.
What is the explanation for this 10x increase in file size? The data read in are 'single' format. And that is the exact data I am writing out.
Dave
David
David
最後のアクティビティ: 2023 年 12 月 1 日

Unlike last year's contest, there are some new technologies this year that might offer some advantages. Namely generative AI's like ChatGPT, Bard, etc. Not to be excluded, MathWorks just launched the AI Chat Playground :)
Hans Scharler
Hans Scharler
最後のアクティビティ: 2024 年 9 月 13 日

The MATLAB AI Chat Playground is open to everyone!
Check it out here on the community: https://www.mathworks.com/matlabcentral/playground
MATLAB AI Chat Playground Screenshot
I just published a blog post announcing the release.
Christine
Christine
最後のアクティビティ: 2024 年 2 月 7 日

i need to create an app in app designer that is able to convert ac to dc. i already created the layout of the app and i created a curcuit that is able to convert ac to dc in sumilink. but i am having troubles linking the circuit simulation to the app.
Basically, i want the user to input the voltage in the app and it should send that data to the simulation and the output should come back to the app.
雕

最後のアクティビティ: 2023 年 11 月 7 日

I want to use "phased" fuction to generate pedestrain dataset, but I don't know how to generate multi-path.
靖邦
靖邦
最後のアクティビティ: 2023 年 11 月 7 日

Hi
I connected raspberry pi with MATLAB. But when I deployed the function, I kept reminding me that the function was not found. But my function does exist and can be implemented
Can you tell me why and how to solve it?
Many thanks,
Bang
仟仟
仟仟
最後のアクティビティ: 2024 年 2 月 7 日

When I apply genetic algorithm to find the optimal parameter, before the parameter enters the algorithm, I have controlled the parameter to keep two decimals in their respective ranges, but when the final output, the optimal parameter returned is really six decimals. Why? What am I supposed to do? (Note: I need to keep two decimal places in the parameter before entering the algorithm, because a change of 0.001 in the parameter has a great effect on the result, so I can't round the result directly.)Look forward to your reply~
Hans Scharler
Hans Scharler
最後のアクティビティ: 2024 年 2 月 16 日

Go to top of page