I am trying to graph this streamline function with a rotation T less than B. I keep getting an error that states matrix dimensions must agree for Psi, how do I fix this?
clear all;
clc;
xymax=0.8;
x=linspace(-xymax,xymax,100);
y=linspace(-xymax,xymax,100);
[X,Y]=meshgrid(x,y);
r=sqrt(X.^2 + Y.^2);
sin_th=Y./r;
U=4;
R=0.1;
B= 4*pi*R*U;
T=-8:0.25:B;
Psi=U*(r- R*R./r).*sin_th+((T./(2*pi)).*log(r/R));
figure
contour(X,Y,Psi,-3:0.25:3,'B')

 Respuesta aceptada

Star Strider
Star Strider el 11 de Abr. de 2019
Your matrices are (100 x 100), and ‘T’ is (1 x 53).
If you instead create ‘T’ as:
T = linspace(-8, B, 100);
your code works, and produces an interesting plot!

4 comentarios

Uomasha Karim
Uomasha Karim el 11 de Abr. de 2019
oh thank you! Would this make T < B? I actually wanted to create a plot that looks closer to this Capture.PNG
My pleasure!
The upper limit to to ‘T’ is ‘B’, so that makes T<=B.
I am not certain what you are doing, or what your calculations represent, so I cannot specifically suggest any changes to it based on my understanding of it. If I use:
T = linspace(0, B, 100);
that is, with ‘T’ starting at 0, the plot is closer to your drawing than with ‘T’ starting at -8.
Also, if you use:
axis equal
after the plot, it looks better.
If my Answer helps you solve your problem, please Accept it!
Uomasha Karim
Uomasha Karim el 11 de Abr. de 2019
Thanks so much! Very helpful
Star Strider
Star Strider el 11 de Abr. de 2019
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Preguntada:

el 11 de Abr. de 2019

Comentada:

el 11 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by